[LRUG] Setting default roles in a user record
Tim Cowlishaw
tim at timcowlishaw.co.uk
Tue Aug 7 07:32:42 PDT 2007
On 8/7/07, Pratik Naik <pratik at thinkwares.com> wrote:
>
> How about
>
> ===
> class Whatever
>
> def with_roles=(roles)
> self.roles << roles
> end
>
> end
>
> Whatever.new :with_roles => Roles.find_default_roles
> ===
or even this perhaps?
===
class Whatever
def with_roles(roles=[default_role_1,default_role_2])
self.roles << roles
end
end
Whatever.new :with_roles
===
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20070807/1ccd1b01/attachment-0003.html>
More information about the Chat
mailing list