diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-16 23:14:11 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-16 23:14:11 -0700 |
commit | f5ecb133335dbfcb2322e5ce91158cf91f730aea (patch) | |
tree | 02e3644bb298c558bf79df1bc20a6c01d0266ee2 /activerecord/test/models/person.rb | |
parent | 077031691df0070be39a965a7eee07a9e5b1c4fe (diff) | |
parent | 1d6eabb67758dd607f8cbcd38da76eb2c9146844 (diff) | |
download | rails-f5ecb133335dbfcb2322e5ce91158cf91f730aea.tar.gz rails-f5ecb133335dbfcb2322e5ce91158cf91f730aea.tar.bz2 rails-f5ecb133335dbfcb2322e5ce91158cf91f730aea.zip |
Merge pull request #9747 from macksmind/refactor_friend_follower
Refactor Person/Friendship relationships to be more intuitive
Diffstat (limited to 'activerecord/test/models/person.rb')
-rw-r--r-- | activerecord/test/models/person.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index fa717ef8d6..2985160d28 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -8,7 +8,10 @@ class Person < ActiveRecord::Base has_many :posts_with_no_comments, -> { includes(:comments).where('comments.id is null').references(:comments) }, :through => :readers, :source => :post - has_many :followers, foreign_key: 'friend_id', class_name: 'Friendship' + has_many :friendships, foreign_key: 'friend_id' + # friends_too exists to test a bug, and probably shouldn't be used elsewhere + has_many :friends_too, foreign_key: 'friend_id', class_name: 'Friendship' + has_many :followers, through: :friendships has_many :references has_many :bad_references |