aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/through_association_scope.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb
index 81e29f047b..09f92332cf 100644
--- a/activerecord/lib/active_record/associations/through_association_scope.rb
+++ b/activerecord/lib/active_record/associations/through_association_scope.rb
@@ -73,7 +73,7 @@ module ActiveRecord
case left.macro
when :belongs_to
left_primary_key = left.klass.primary_key
- right_primary_key = right.primary_key_name
+ right_primary_key = left.primary_key_name
when :has_many, :has_one
left_primary_key = left.primary_key_name
right_primary_key = right.klass.primary_key