ryanb / cancan

Authorization Gem for Ruby on Rails.
MIT License
6.28k stars 785 forks source link

Cancan 2.0: Using a namespaced Controller with a non-namespaced model #920

Open 8bithero opened 10 years ago

8bithero commented 10 years ago

I've come across a case while using Cancan 2.0 which I'm not sure if it's a bug or the expected behavior - if you could please help clarify that would be a big help.

I have a namespaced controller Developers::StudiosController which uses the model Studio.rb which is not namespaced.

When creating a new studio (/developers/studios/new), the only way to successfully load_and_authorize_resource seems to be with the following abilities:

can [:read, :create], :'developers/studios' # line 1
can :create, :studios # line 2

It seems a bit strange that :create needs to be specified in both lines 1 & 2 - if not, I get a 'not authorized' error.

Is this a bug, an error on my part or is it the intended behavior? If it's intentional, could you please elaborate a bit on the semantics of it?

Thanks in advance.

xhoy commented 10 years ago

Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013. Since only Ryan himself has commit permissions, the CanCan project is on a standstill.

CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.

If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.

We hope to see you on the other side!