title: Rails 4 - Pundit with Rolify - permitting a group of roles
body: <p>I am trying to make an app with Rails 4.</p>
  
  <p>I have defined a series of roles with Rolify gem.</p>
  
  <p>Now, I want to use pundit to allow users with a role to do certain things. Where more than one type of role can do a thing, I have defined a group of roles.</p>
  
  <p>In my application_policy, I have defined private methods which set out the groups of roles that I want to use in the pundit permissions.</p>
  
  <p>My application policy instantiates user and record. I then define record as the name of the relevant model (the same name as the policy for that model).</p>
  
  <p>I have:</p>
  
  <pre><code>class ApplicationPolicy
    attr_reader :user, :record
  
    def initialize(user, record)
      @user = user
      @record = record
    end
  
    def index?
      false
    end
  
    def show?
      scope.where(:id =&gt; record.id).exists?
    end
  
    def create?
      false
    end
  
    def new?
      create?
    end
  
    def update?
      false
    end
  
    def edit?
      update?
    end
  
    def destroy?
      false
    end
  
    def scope
      Pundit.policy_scope!(user, record.class)
    end
  
    class Scope
      attr_reader :user, :scope
  
      def initialize(user, scope)
        @user = user
        @scope = scope
      end
  
      def resolve
        scope
      end
    end
  
    private
  
  
      def cf_legal
        [ :Admin, :CF_Legal, :CF_Policy_Manager ]
      end
  
      def cf_content
        [ :Admin, :CF_Author, :CF_Editor ]
      end
  
  
  end
  </code></pre>
  
  <p>Then in my content policy, I want to say:</p>
  
  <pre><code>def record
     content
  end
  
  def create
      user.has_role? :cf_content
  end
  </code></pre>
  
  <p>When I save this and try it, I can't see the thing that I am supposed to see (as a user with the role Author.</p>
  
  <p>Can anyone see how to do this?</p>