Created
October 14, 2013 17:08
-
-
Save kousuke-takeuchi/6978813 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
## user.rb | |
... | |
has_many :followed_animes, through: :relationships, source: :followed | |
has_many :relationships, foreign_key: "follower_id", dependent: :destroy | |
... | |
## some_model.rb | |
... | |
## 実は何もしなくても良い | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment