From 8c0ba7b69b0952e1f71425ad19e97de8f4dc1be8 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Oct 2013 16:13:19 -0700 Subject: [PATCH] join parts in `build` are *always* new, so don't bother checking --- activerecord/lib/active_record/associations/join_dependency.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index dace5503e5..f12d5c49b5 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -182,7 +182,8 @@ def find_reflection(klass, name) def build(associations, parent, join_type) associations.each do |name, right| reflection = find_reflection parent.base_klass, name - join_association = find_or_build_scalar reflection, parent, join_type + join_association = build_join_association reflection, parent, join_type + @join_parts << join_association build right, join_association, join_type end end