title: CanCan and InheritedResources: load and authorize resource through a singleton resource without ID param in the URL
body: <p>My users can define their own vocabularies.</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :vocabularies
  end
  
  class Vocabulary &lt; ActiveRecord::Base
    belongs_to :user
  end
  </code></pre>
  
  <p>Routes:</p>
  
  <pre><code>resource :user do
    resources :vocabularies
  end
  </code></pre>
  
  <p>Now I want to use CanCan to load and authorize the vocabulary resource through the loaded user resource in the <code>CategoriesController</code>, but I'm pretty unsure how to configure CanCan correctly.</p>
  
  <p>One thing is that I don't pass the user's ID through the URL params, so I have to tell CanCan somehow manually how to load the user. My guess is that I can simply do a <code>through: :current_user</code>. And because it is a singleton resource, I think I will have to pass the <code>singleton: true</code> option:</p>
  
  <pre><code>class VocabulariesController &lt; ApplicationController
    inherit_resources
    belongs_to :current_user # Is this correct?
    load_and_authorize_resource through: :current_user, singleton: true
  end
  </code></pre>
  
  <p>But when trying to access <code>user/vocabularies</code>, I'm getting a <code>Couldn't find Vocabulary without an ID</code> error. And <code>user/vocabularies/new</code> results in <code>undefined method</code>current_user=' for #`. No idea where's the problem, is it CanCan? InheritedResources? Misconfig?</p>