title: Pundit::AuthorizationNotPerformedError with Devise controller
body: <p>I am fairly new to using this Pundit gem but seem to be having trouble understanding the policy system. I have added checks that Pundit has been called for authorization (<code>verify_authorized</code>) and for scoping (<code>verfify_policy_scoped</code>). However, this causes errors when I visit the Devise sessions controller.</p>
  <p>Application Controller</p>
  <pre><code>class ApplicationController &lt; ActionController::Base
    include Pundit
    protect_from_forgery
    before_filter :authenticate_person!
  
    # Verify that controller actions are authorized. Optional, but good.
    after_filter :verify_authorized,  except: :index
    after_filter :verify_policy_scoped, only: :index
  
  
    rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
  
    private
  
    def pundit_user
      Person.find_by_id(current_person)
    end
  
    def user_not_authorized
      flash[:alert] = &quot;You are not authorized to perform this action.&quot;
      # redirect_to(request.referrer || root_path)
    end
  end
  </code></pre>
  <p>Application Policy</p>
  <pre><code>class ApplicationPolicy
    attr_reader :user, :record
  
    def initialize(user, record)
      raise Pundit::NotAuthorizedError, &quot;must be logged in&quot; unless user
      @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
  end
  </code></pre>
  <p>Error Messages</p>
  <pre><code>Pundit::AuthorizationNotPerformedError in
    Devise::SessionsController#new
  
  Pundit::PolicyScopingNotPerformedError in
    ...
  </code></pre>