2010/5/20 Iñaki Baz Castillo <[email protected]>:
>> http://wiki.github.com/activescaffold/active_scaffold/security
>
> Hi Sergio. It works, however the wiki is wrong then as it shows a
> instance method rather than a class method (in Model security):
>
> def authorized_for_delete?
>  # anonymous users may never destroy these/this records
>  return false unless current_user
>  # unless it's an existing record and a 'permanent' flag has been thrown
>  return (self.permanent == false)
> end


Sorry, it's well explained in the doc:

Most methods are defined on the instance level (e.g. def
authorized_for_update?), but e.g. def self.authorized_for_create? is
defined as a class method, because there is no record against which
the create-permissions can be checked. Thus, authorized_for_create? is
never called on a record.



-- 
Iñaki Baz Castillo
<[email protected]>

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