Created
September 10, 2008 16:42
-
-
Save tokumine/9940 to your computer and use it in GitHub Desktop.
This file contains 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 StarWarsCharacters < ActiveRecord::Base | |
named_scope :born_on_tatooine, :conditions => ["birthplace LIKE ?", "Tatooine"] | |
end | |
class Jedi < StarWarsCharacters | |
end | |
class Sith < StarWarsCharacters | |
end | |
> Sith.create :name => "Darth Vader", :birthplace => "Tatooine" | |
> reload! | |
> Jedi.born_on_tatooine | |
=> [] | |
> Sith.born_on_tatooine | |
=> #<Sith id: 1, name: "Darth Vader", type: "Sith">] | |
Good! | |
> Jedi.born_on_tatooine | |
=> #<Sith id: 1, name: "Darth Vader", type: "Sith">] | |
????? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment