mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
1d6eabb677
PR #5210 added a Friendship model to illustrate a bug, but in doing so created a confusing structure because both belongs_to declarations in Friendship referred to the same side of the join. The new structure maintains the integrity of the bug test while changing the follower relationship to be more useful for other testing.
6 lines
316 B
Ruby
6 lines
316 B
Ruby
class Friendship < ActiveRecord::Base
|
|
belongs_to :friend, class_name: 'Person'
|
|
# friend_too exists to test a bug, and probably shouldn't be used elsewhere
|
|
belongs_to :friend_too, foreign_key: 'friend_id', class_name: 'Person', counter_cache: :friends_too_count
|
|
belongs_to :follower, class_name: 'Person'
|
|
end
|