cancancan manage a relationship Rails <p>I am running into an issue with the cancancan gem for rails</p> <pre><code>gem 'cancancan', '~&gt; 1.10' </code></pre> <p>I have four models: User, Company, Locations, Groups</p> <p>User: Belongs to Company Company: Has many Locations Location: Belongs to company Group: Belongs to Location</p> <p>In the abilities model I have this:</p> <pre><code>can :manage, Group, :location =&gt; {:id =&gt; user.company.locations.map{|l| l.id}} </code></pre> <p>When creating a new group I am denied (don't have access)</p> <p>I am looking for the correct way to allow a User to create a group with one of the companies location id's (NOTE: Without cancancan on this all works and all ID's are related and so on).</p>