On Jueves, 6 de septiembre de 2012 04:39:44 Mike Blyth escribió:
> I'm trying to get rid of the "Create new" link conditionally, when users
> are not authorized to create. I'm using CanCan. The links within rows are
> suppressed properly (or greyed out), but the top-of-page Create link is
> still there. I have tried
> 
>    - def authorized_for_create? # in model
>      false
>    end
>    - def authorized_for_new? # in model, out of desperation
>      false
>    end
>    - def create_authorized? # in controller
>      false
>    end
> 
> What is the right way?

 def self.authorized_for_create?
It must a class method, because there is no record to check authorization.

But if you use CanCan you should use can methods in your ability model.


-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to