Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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">]
- ?????
Add Comment
Please, Sign In to add comment