title: Cancan nested_routes restrict acces to :index
body: <p>I have some problems with cancan and a nested routes.</p>
  
  <p>I have this routes :</p>
  
  <pre><code>resources :companies do
     resources :projects
  end
  </code></pre>
  
  <p>I have no problem with the abilities for Company model but for the Project model I want to deny the access to Project#index if they are not admin of the company.</p>
  
  <p>The next code works :</p>
  
  <pre><code>can :show, Company do |company|
     if user.admins.include?(company) #check if the user is admin of the company
        can :index, Schedule, :company_id =&gt; company.id
     end
  end 
  </code></pre>
  
  <p>But how I can do :</p>
  
  <pre><code>can? :index, Project
  </code></pre>
  
  <p>I tried by renamed the method like that :</p>
  
  <pre><code>can :index_projects, Company do |company|
     if user.admins.include?(company) #check if the user is admin of the company
        can :index, Schedule, :company_id =&gt; company.id
     end
  end
  </code></pre>
  
  <p>and use :</p>
  
  <pre><code>can? :index_projects, @company
  </code></pre>
  
  <p>But it doesn't work. Do you know how to do it?</p>
  
  <p>Thanks.</p>