Created
October 10, 2012 16:52
-
-
Save samiron/3866858 to your computer and use it in GitHub Desktop.
Rails 3: has_many :through
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
| #FILE: models/user.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a complete demonstration of
many-to-manyrelationship usinghas_many :throughbetween two models.Here we have
TeamandPlayermodels where each can contain many of other.Like, a team has many players and a player has many teams. They are related through
Contractmodel which hasplayer_id,team_idandoffercolumns.The focus is to show