Tuesday, August 9, 2011

Re: [Rails] Re: CanCan doesn't work on this model

On Aug 9, 2011, at 12:39 PM, Leonel *.* wrote:

> I kept on simplifying the code to get to the root of the problem and
> it
> seems it won't work regardless of what I do.
>
> in ability.rb
> can :manage, :all
>
> so it's supposed to allow the user to do ANYTHING right? wrong!
>
> if in users_controller.rb I tried working with nested resources, it
> ALWAYS gives me Access Denied error.
>
> users_controller.rb
> load_resource :company
> load_resource :user, :through => :company

Try changing this to simply:

#users_controller.rb
load_and_authorize_resource

I believe that will get all of the nested stuff automagically, you
don't have to specify the relationship. After all, that's what your
models are for.

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate