Hi, I am using rollify and just realized that in fact I am not using it fully.
I'm currently doing something in my controller, for example, re-redirecting users if current_user.has_role? :whatever_role current_user.has_role? :whatever_role , and allows users to have any other role ...
Someone asked a stackoverflow question about what needs to be done, and when I try to answer it, I realized that I was doing it wrong.
Now, this is where my confusion begins ... Inside the .rb ability I have:
user ||= User.new # guest user (not logged in) if user.has_role? :consumer can :manage, Review else can :read, Review end
Now let's say that I am adding a consumer role to the user:
x=User.last x.add_role :consumer # => #<Role id: 10, name: "consumer", resource_id: nil, resource_type: nil, created_at: "2013-04-18 23:00:46", updated_at: "2013-04-18 23:00:46">
That's right, so the role is created. I can verify this by doing:
x.has_role? :consumer => true
Now I expect this to provide a way to manage reviews ...
x.has_role? :consumer, Review => true
but not for other models ... here I try products
x.has_role? :consumer, Product => true
In addition, when I look at the โrequest resource rolesโ and try to request applicable roles for reviews, I cannot find the roles attached:
Review.first.applied_roles => []
Can someone please explain please to me. Thanks