cancan icon indicating copy to clipboard operation
cancan copied to clipboard

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

Open 8bithero opened this issue 11 years ago • 1 comments

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.

8bithero avatar Aug 16 '13 12:08 8bithero

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!

xhoy avatar Jul 01 '14 07:07 xhoy