aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/person.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-16 23:14:11 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-16 23:14:11 -0700
commitf5ecb133335dbfcb2322e5ce91158cf91f730aea (patch)
tree02e3644bb298c558bf79df1bc20a6c01d0266ee2 /activerecord/test/models/person.rb
parent077031691df0070be39a965a7eee07a9e5b1c4fe (diff)
parent1d6eabb67758dd607f8cbcd38da76eb2c9146844 (diff)
downloadrails-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.rb5
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