1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

array subtraction should be faster than iterating over all the elements

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Neeraj Singh 2010-06-28 22:33:10 -04:00 committed by José Valim
parent e8f88a3298
commit dabf74b495

View file

@ -6,7 +6,7 @@ module ActiveRecord
merged_relation = clone merged_relation = clone
return merged_relation unless r return merged_relation unless r
(Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS).reject {|m| [:joins, :where].include?(m)}.each do |method| ((Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS) - [:joins, :where]).each do |method|
value = r.send(:"#{method}_values") value = r.send(:"#{method}_values")
merged_relation.send(:"#{method}_values=", value) if value.present? merged_relation.send(:"#{method}_values=", value) if value.present?
end end