ryanb/cancan — Issue #504: Accessing parent in nested routes
Author: jensb1
Created: 2011-11-02 14:09:32+00:00
State: open

Hello,

I have nested route:

```
resources :customer do
resources :employees
end
```
thus I can access the new page with ```/customer/:id/employee/new```

what i now want is to control the access to certain pages in the employee controller depending on what customer I have chosen (:id=NNN). For example the employee#new should not be accessible if the current user don't have administration rights for the customer.

I have tried

```
can :new, Contact, :customers => {:customer_id => user.administrating.map(&:id)}
```

but the problem is that the contact object in #new is just Contact.new, so it don't contain any pointer to the customer object.