Hi Folks,
I have an array has_roles = %w[admin employee ...] which is a subset of
application_roles = ["admin", "employee",
"manager"...]
Now I would define a method for each role in application roles where i
would call methods like
@logged_in_user.admin which returns true because has_roles
includes "admin"
@logged_in_user.employee which returns true because has_roles
includes
"employee"
@logged_in_user.manager which returns false because has_roles
doesnot
include "manager"
I came accross using define_method in class Module for this purpose but
went wrong some where. Can any one there achieve this using
define_method. Its very urgent any help appreciated..thanks in
advance...
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---