Created
June 27, 2014 21:51
-
-
Save anonymous/98296ce3f93d5fa53884 to your computer and use it in GitHub Desktop.
Active Record Associations
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 User < ActiveRecord::Base | |
has_one :collection | |
has_many :tracks, :through => "collection" | |
end | |
class Collection < ActiveRecord::Base | |
belongs_to :user | |
has_many :tracks | |
end | |
class Track < ActiveRecord::Base | |
belongs_to :collection | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment