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…