Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


CanCan with Inherited Resources :class override #982

futbolpal opened this Issue · 0 comments

1 participant


I have a root controller that calls load_and_authorize_resource. One of the inheriting controllers, uses a custom model

defaults :resource_class => [THE_CUSTOM_CLASS]

CanCan works on the create, but not the index action. The load_collection? method calls resource_class method, which in turn looks at the controller name and namespace. For me, this is not correct, it should be overridden by Inherited Resources.

Adding the following to the inherited_resource.rb solves the problem for me:
16 def resource_class
17 @controller.send :resource_class
18 end

What do you think? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.