ruby on rails - Check if a user is a regular user -
i have following code:
class user < activerecord::base named_scope :regular_users, :conditions => { :is_developer => false } end
how can change code return if specific user regular user (has :is_developer => false ) instead of list of regular users?
thanks
you can check user.find(1).is_developer?
(actually work without ?
) check opposite, use ! user.find(1).is_developer?
or not user.find(1).is_developer
or put in model method like
def is_regular? ! is_developer? end
i doubt can boolean value scope.
btw, rails3 can use scope
instead of named_scope
Comments
Post a Comment