CanCan - make up your mind!

If you're using CanCan and came across an error like this;

And you duly updated your controller code from;

To something like this;

Since, like all good programmers, you do what you're told by error-messages. But then like some sick joke it starts mocking you with the inverse error message i.e;

Before you go and stalk Ryan B (the CanCan author) with a fully automatic assault rifle, first check your CanCan versions.

Ah ha. And if you're using RVM like we do, then your default.gems might be specifying a different version (which in our case manifested in our staging server, not on local development).

So by making sure you're using the latest version (>= 1.3.2), and using the :class syntax i.e.

, you might save yourself a murder (or at the very least a weapons) charge.