It would go in the model.
class Location < ActiveRecord::Base
def self.all_from_inner_city
find(:all, :conditions=>{:postcode=>[2001, 2002]})
end
end
Location.all_from_inner_city
or
class Location < ActiveRecord::Base
def self.from_inner_city(*args)
find(args.first,
(args.extract_options!.merge(:conditions=>{:postcode=>[2001, 2002]}))
end
end
Location.from_inner_city(:all, :order => 'id DESC')
Location.from_inner_city(:first)
Cheers,
Dylan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---