diff options
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index f1a3b23d5a..572f556999 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -47,15 +47,8 @@ module ActiveRecord def self.get_bind_values(owner, chain) bvs = [] chain.each_with_index do |reflection, i| - if reflection.source_macro == :belongs_to - foreign_key = reflection.foreign_key - else - foreign_key = reflection.active_record_primary_key - end - if reflection == chain.last - bvs << owner[foreign_key] - + bvs << reflection.join_id_for(owner) if reflection.type bvs << owner.class.base_class.name end |