Venkat Bagam wrote: > 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... If I'm understanding you right... class Roles class << self def admin puts "This person is an admin" end def employee puts "This person is an employee" end end Of course you probably wouldnt use this very example to achieve what your going for, but this is one of the approaches you would take using the define method. - Mac -- Posted via http://www.ruby-forum.com/.