ryanb/cancan — Issue #565: CanCan 2.0: Admin Namespaced 'faux-resource' not Authorized
Author: bsodmike
Created: 2012-02-29 20:07:20+00:00
State: open

Hi,

I was able to briefly discuss this with Ryan over Twitter and [detailed the issue in this Gist](https://gist.github.com/2ca0791f9ca9af8d2629).

The setup comprises of an admin namespace and all Admin controllers inherit from `AdminController`. My `root_url` points to `dashboard#index` and since `enable_authorization` locks down on all controller actions, irrespective of these being DB backed resources or not, I setup an `AdminAbility` that is only created in the `Admin` namespace.

Of course, the DashboardController is namespaced as `Admin::DashboardController` and as such I have my rule as `can :access, :dashboards`. This fails miserably as

```ruby
CanCan::Unauthorized in Admin::DashboardController#index
```

Since this is CanCan 2.0, there is no way to pass `:class => false` as this is not valid for `load_and_authorize_resource` and this is all that is currently supported.

I have so far only been able to get `can :access, :all` to work but this doesn't really help much. Any thoughts?