title: What is the purpose of Rolify?
body: <p>Hi I'm using rolify and have just realized that I'm not actually taking advantage of it's full potential.</p>
  
  <p>At present I am doing things in my controller like re-routing users if <code>current_user.has_role? :whatever_role</code>, and allowing users if they have whatever other role...</p>
  
  <p>Someone asked a question on stackoverflow about rolify and when I got to trying to answer it, I realized that I'm doing it wrong.</p>
  
  <p>Now, here is where my confusion starts... Inside of ability.rb I have:</p>
  
  <pre><code>user ||= User.new # guest user (not logged in)
  if user.has_role? :consumer
    can :manage, Review
  else
    can :read, Review
  end
  </code></pre>
  
  <p>Now let's say I add the consumer role to a user:</p>
  
  <pre><code>x=User.last
  x.add_role :consumer
  # =&gt; #&lt;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"&gt; 
  </code></pre>
  
  <p>Right, so the role is created. I can check this by doing:</p>
  
  <pre><code>x.has_role? :consumer
  =&gt; true
  </code></pre>
  
  <p>Now I would expect this to give management ability for reviews...</p>
  
  <pre><code>x.has_role? :consumer, Review
  =&gt; true
  </code></pre>
  
  <p>but not for other models... here I try products</p>
  
  <pre><code>x.has_role? :consumer, Product
  =&gt; true
  </code></pre>
  
  <p>Further, when I look at "resource roles querying" and try to query the applied roles for reviews I find no applied roles:</p>
  
  <pre><code>Review.first.applied_roles
  =&gt; []
  </code></pre>
  
  <p>Can someone please explain rolify to me. Thanks</p>