diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 17:51:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 17:51:46 -0700 |
commit | 8d5829f149e6817babc4616c28e53162afbe9c48 (patch) | |
tree | 67568bab8769db1f5d4834e702e975c9f6fa0053 | |
parent | dc16163d068479993002f5540368b8dbcc3724d1 (diff) | |
download | rails-8d5829f149e6817babc4616c28e53162afbe9c48.tar.gz rails-8d5829f149e6817babc4616c28e53162afbe9c48.tar.bz2 rails-8d5829f149e6817babc4616c28e53162afbe9c48.zip |
dup rather than create so many arrays
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index c2af4b1571..e644670019 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -26,14 +26,14 @@ module ActiveRecord merged_relation = merged_relation.joins(r.joins_values) - merged_wheres = @where_values + merged_wheres = @where_values.dup r.where_values.each do |w| if w.respond_to?(:operator) && w.operator == :== merged_wheres = merged_wheres.reject {|p| p.respond_to?(:operator) && p.operator == :== && p.operand1.name == w.operand1.name } end - merged_wheres += [w] + merged_wheres << w end merged_relation.where_values = merged_wheres |