Skip to content

Commit

Permalink
array subtraction should be faster than iterating over all the elements
Browse files Browse the repository at this point in the history
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
Neeraj Singh authored and josevalim committed Jun 29, 2010
1 parent e8f88a3 commit dabf74b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation/spawn_methods.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def merge(r)
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
Expand Down

0 comments on commit dabf74b

Please sign in to comment.