can :manage, Comment, :user_id => not working, but :user => {:id =>} works #502

swobspace opened this Issue Nov 1, 2011 · 5 comments


None yet

4 participants


The following definition didn't give the user @usr any rights:

can :manage, Comment, :user_id =>

But if I use the following definition

can :manage, Comment, :user => { :id => }

all works as expected. As the wiki page "Defining Abilities" mentioned, both should be equivalent.

I'm using Rails 3.1.1, cancan 1.6.7 and ruby 1.8.7.



what is its role?
i use it in my app, had an exception:
RuntimeError in RailsAdmin::MainController#new

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

Gimi commented May 12, 2012

I've just tested it in a new Rails 3.1.1 application with cancan 1.6.7 and ruby 1.8.7, and didn't have this problem. Are you still having this problem? If you are, would you please offer more details?

andhapp commented May 17, 2012

@swobspace: I am going to close this issue for now. If you still have this issue, please comment here and it'll be reopened for further discussion/investigation.

@andhapp andhapp closed this May 17, 2012

i have fixed it,can i use like this :manage, Comment, :user_id =>


@Gimi @andhapp: I can't test it at the moment, I switched to Rails 3.2 with the patch from jpascal #577 to use rails 3.2 mass assignment stuff., so I'm not on the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment