Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: d868322c53
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (19 sloc) 1.46 KB

Upgrade instructions for Rolify library

From a previous rolify installation (1.x or 2.x)

The easiest way is to re-run the generator using rails g Rolify:Role command, and overwrite the initializer file. Both the migration file and the role.rb haven't changed. In the config/initializers/rolify.rb file, here are the deprecated settings:

  • role_cname

  • user_cname

By default, these settings were commented out, so you can safely remove them. If you changed them, you can remove them in the initializer file too. user_cname is no longer used in 3.x, you don't need it anymore. Add your custom role_cname setting as argument of the rolify method you use in your User class. For instance, if you use Privilege as Role class, you should add this to your whatever your User class is, let's say Client for the sake of example:

class Client < ActiveRecord::Base
  rolify :role_cname => "Privilege"

If you use the default Role class name, you don't have to specify the :role_cname argument.

If you use dynamic methods (user.is_admin? like methods), you should turn it on using use_dynamic_shortcuts method starting from rolify 3.0:

Rolify.configure do |c|

The old fashion way still works though, but won't work anymore if the setter method name is changed in a possible future. You've been warned :-)

Jump to Line
Something went wrong with that request. Please try again.