diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-20 17:49:16 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-20 17:49:16 -0700 |
commit | bff89a2022aedec60929f6d6744eefc84a5c102a (patch) | |
tree | cc64225909c3a89e5f4fb76630c62a7425ed55e7 /activerecord/lib/active_record/relation/merger.rb | |
parent | 52ed881fa296a05374a5a3395f92a653b3721298 (diff) | |
download | rails-bff89a2022aedec60929f6d6744eefc84a5c102a.tar.gz rails-bff89a2022aedec60929f6d6744eefc84a5c102a.tar.bz2 rails-bff89a2022aedec60929f6d6744eefc84a5c102a.zip |
eliminate some conditionals
Diffstat (limited to 'activerecord/lib/active_record/relation/merger.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/merger.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb index 0f54d91d86..98afeb8cc5 100644 --- a/activerecord/lib/active_record/relation/merger.rb +++ b/activerecord/lib/active_record/relation/merger.rb @@ -145,10 +145,10 @@ module ActiveRecord # Remove equalities from the existing relation with a LHS which is # present in the relation being merged in. def reject_overwrites(lhs_wheres, rhs_wheres) - seen = Set.new - rhs_wheres.each do |w| - seen << w.left if w.respond_to?(:operator) && w.operator == :== + nodes = rhs_wheres.find_all do |w| + w.respond_to?(:operator) && w.operator == :== end + seen = Set.new(nodes) { |node| node.left } lhs_wheres.reject do |w| w.respond_to?(:operator) && w.operator == :== && seen.include?(w.left) |