title: Cancan with database roles and abilities: AuthorizationNotPerformed
body: <p>I'm building a <a href="https://github.com/ryanb/cancan/wiki/Ensure-Authorization" rel="nofollow">site-wide</a> cancan auth system. Just to get very simple validation of my attempts, I'm initializing my test cases every time I try to hit a page:</p>
  
  <pre><code># application_controller.rb
  class ApplicationController &lt; ActionController::Base
    admin = Role.new(name: :admin, is_default: true)
    admin.permissions &lt;&lt; Permission.create(action: :manage, subject_class: :all)
    admin.save
    current_user=User.create!
    # users automatically get associations to all roles with `is_default: true`
  
    check_authorization
  end
  </code></pre>
  
  <p>Only controllers with <code>skip_authorization_check</code> are letting me through, all others throw the <a href="https://github.com/ryanb/cancan/blob/master/lib/cancan/controller_additions.rb#L251" rel="nofollow"><code>AuthorizationNotPerformed</code></a> error:</p>
  
  <pre><code>CanCan::AuthorizationNotPerformed in ExampleAuthEngin::PermissionsController#index
  
  This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check.
  </code></pre>
  
  <p>What am I doing wrong?</p>