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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -