Claudio, you are wrong. There are default controller methods to test security 
which call model methods, because there are no record they use class methods, 
as Schlinge's method.

I have just fixed, it was broken when I restored old behaviour of disabled 
action links (which is only used for member action links, not collection ones)

On Martes, 11 de septiembre de 2012 12:13:50 Cláudio Forain escribió:

Try putting this method in the controller. If you read the documentation 
closely, you willsee that list and create are placed there, because they 
aren't associated with any existing record.

On Sep 11, 2012 10:40 AM, "Schlinge" <[email protected]> wrote:
>
> I am using AS security methods in order to restrict actions for unauthorized 
users.
>
> I implemented a class method in my model as follows:
>
> class MyModel < ActiveRecord::Base
>   # ...
>   protected
>   def self.authorized_for_create?
>     false
>   end
> end
>
> MyModel acts like expected in the rails console ...
>
> 1.9.3p194 :001 > MyModel.authorized_for_create?
>  => false
>
> ... and a 401 Unauthorized Error is logged in the server output when i click 
on the create link ...
> But why is the create link at the top of the list still being rendered?
>
> Is it a bug or do i miss something out?
> Any ideas? Anybody?
>
> -- 
> You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
> To view this discussion on the web visit 
https://groups.google.com/d/msg/activescaffold/-/9dCk5QfF62AJ.
> 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.

-- 
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.



-- 
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