From 9ef701d659bb4015e926994c166977b07dbfc2db Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 24 Feb 2012 16:55:11 -0800 Subject: use regular ruby for fewer method calls. we do not need :gift:s! --- activerecord/lib/active_record/relation/spawn_methods.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation') diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 7131aa29b6..706b0cd1cc 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -24,7 +24,10 @@ module ActiveRecord (Relation::MULTI_VALUE_METHODS - [:joins, :where, :order]).each do |method| value = r.send(:"#{method}_values") - merged_relation.send(:"#{method}_values=", merged_relation.send(:"#{method}_values") + value) if value.present? + next if value.empty? + + value += merged_relation.send(:"#{method}_values") + merged_relation.send :"#{method}_values=", value end merged_relation.joins_values += r.joins_values -- cgit v1.2.3