title: uninitialized constant Home -- thrown by CanCanCan for non-db backed resource
body: <p>I am using CanCanCan for authorization purposes. Basically what I want to happen is non-logged in users can access <code>Home#Index</code>, but they need to be logged in for <code>Home#Dashboard</code>.</p>
  
  <p>I have this route:</p>
  
  <pre><code>get 'dashboard', to: 'home#dashboard', as: :dashboard
  </code></pre>
  
  <p>This is my <code>HomeController</code>:</p>
  
  <pre><code>class HomeController &lt; ApplicationController
    authorize_resource except: [:index]
    skip_authorization_check only: [:index]
    layout 'marketing', only: [:index]
  
    def index
    end
  
    def dashboard
    end
  end
  </code></pre>
  
  <p>This is my <code>application_controller.rb</code>:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery with: :exception
    before_action :configure_permitted_parameters, if: :devise_controller?
    check_authorization :unless =&gt; :devise_controller?
  
    rescue_from CanCan::AccessDenied do |exception|
      respond_to do |format|
        format.json { head :forbidden }
        format.html { redirect_back(fallback_location: root_path, flash: { danger: exception.message }) }
      end
    end
  
    protected
  
    def configure_permitted_parameters
      devise_parameter_sanitizer.permit(:accept_invitation, keys: [:first_name, :last_name, :phone])
    end
  end
  </code></pre>
  
  <p>However, when I go to <code>/dashboard</code>, this is the error I get:</p>
  
  <pre><code>NameError - uninitialized constant Home:
    activesupport (5.0.0.1) lib/active_support/dependencies.rb:550:in `load_missing_constant'
    activesupport (5.0.0.1) lib/active_support/dependencies.rb:203:in `const_missing'
    activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:268:in `block in constantize'
    activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
    activesupport (5.0.0.1) lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
  </code></pre>
  
  <p>What could be causing this?</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>After some debugging, I now realize that it seems to be related to the fact that the action I am <code>authorizing</code> isn't backed by an ActiveRecord resource. </p>
  
  <p>In other words, once I add <code>:dashboard</code> to the <code>exception</code> list, like so:</p>
  
  <pre><code>  authorize_resource except: [:index, :dashboard]
    skip_authorization_check only: [:index, :dashboard]
  </code></pre>
  
  <p>It works. The page loads like a charm.</p>
  
  <p>So I guess the real issue is, how do I authorize/lock down a resource that is not an ActiveRecord model?</p>