I have an app with devise. I installed the role_model and cancan gems. I updated the user.rb to read:
require 'rubygems'
require 'role_model'
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me, :roles, :roles_mask
include RoleModel
roles_attribute :roles_mask
roles :admin, :contributor, :guest
end
Then, in the rails console I try
> u = User.find(:first)
User Load (1.2ms) SELECT "users".* FROM "users" LIMIT 1
=> #<User id: ...
> u.roles = [:admin]
NoMethodError: undefined method `roles_mask=' for #<User:0x00000002b57500>
from /home/xxx/.rvm/gems/ruby-1.9.3-p194@rails-3.2.11/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:in `method_missing'
Where does roles_mask come from? Do I need to include something else?