Created
February 18, 2011 14:04
-
-
Save paulelliott/833687 to your computer and use it in GitHub Desktop.
Proper Use of Fabricators - AR classes
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 Manufacturer < ActiveRecord::Base | |
has_many :models | |
validates_presence_of :name | |
end | |
class Model < ActiveRecord::Base | |
belongs_to :manufacturer | |
has_many :motorcycles | |
validates_presence_of :name | |
end | |
class Motorcycle < ActiveRecord::Base | |
belongs_to :model | |
belongs_to :owner | |
validates_presence_of :vin | |
end | |
class Owner < ActiveRecord::Base | |
has_many :motorcycles | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment