I have the following code:
class User < ActiveRecord::Base
named_scope :regular_users, :conditions => { :is_developer => false }
end
How can I change this code to return if a specific user is a regular user (has :is_developer => false ) instead of a list of all regular users?
Thanks
You can just check
User.find(1).is_developer?(actually it will work even without the?)To check the opposite, use
! User.find(1).is_developer?ornot User.find(1).is_developeror put this in a model method like
I doubt that you can get boolean value with scope.
btw, with Rails3 you can use
scopeinstead ofnamed_scope