Created
December 28, 2015 17:43
-
-
Save SteveOscar/43a942ea6d814d30daf2 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 Article < ActiveRecord::Base | |
has_many :article_newspapers | |
has_many :newspapers, :through => :article_newspapers | |
end | |
Class Newspaper < ActiveRecord::Base | |
has_many :article_newspapers | |
has_many :articles, :through => :article_newspapers | |
end | |
Class ArticleNewspaper < ActiveRecord::Base #the join table | |
belongs_to :article | |
belongs_to :newspaper | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment