Created
May 2, 2010 22:40
-
-
Save dtrasbo/387523 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car < ActiveRecord::Base | |
named_scope :color, lambda { |color| {:conditions => {:color => color }} } | |
named_scope :by_age, :order => 'created_at' | |
end | |
Car.color('red').by_age # returns all cars where color equals red ordered by age |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment