aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-11 16:46:28 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-11 16:46:28 -0700
commit68c08111fbb78befd1811136a6cbcb157bd3e914 (patch)
treec7353ace545009ebf3863ded75cd6058f46bebc6 /activerecord
parent5bef5cfd448d41d61f6794ace5188efc16daab65 (diff)
downloadrails-68c08111fbb78befd1811136a6cbcb157bd3e914.tar.gz
rails-68c08111fbb78befd1811136a6cbcb157bd3e914.tar.bz2
rails-68c08111fbb78befd1811136a6cbcb157bd3e914.zip
we always have a reflection and it is on the node
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 54dcd67590..650f3a986a 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -149,7 +149,7 @@ module ActiveRecord
def remove_duplicate_results!(base, records, associations)
associations.each do |node|
- reflection = base.reflect_on_association(node.name)
+ reflection = node.reflection
remove_uniq_by_reflection(reflection, records)
parent_records = []
@@ -189,7 +189,7 @@ module ActiveRecord
end
def remove_uniq_by_reflection(reflection, records)
- if reflection && reflection.collection?
+ if reflection.collection?
records.each { |record| record.send(reflection.name).target.uniq! }
end
end