You can provide class methods that do wire passing arguments:
def self.male
by_gender('male')
end
def self.female
by_gender('female')
end
or, since the named_scope you are using is so simple that you can cut out the by_gender scope and just use:
named_scope :male, :conditions => {:gender => 'male'}
named_scope :female, :conditions => {:gender => 'female'}
The second option, of course, is due to the fact that you do not actually require the by_gender scope explicitly in another place.
source
share