Permalink
Browse files

we always have a reflection and it is on the node

  • Loading branch information...
1 parent 5bef5cf commit 68c08111fbb78befd1811136a6cbcb157bd3e914 @tenderlove tenderlove committed Oct 11, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/associations/join_dependency.rb
@@ -149,7 +149,7 @@ def deep_copy(parent, node)
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 @@ def build_scalar(reflection, parent, join_type)
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

0 comments on commit 68c0811

Please sign in to comment.