Skip to content

Commit

Permalink
Don't create fibers just to iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
njakobsen committed Aug 30, 2013
1 parent 15455d7 commit 7db835c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activerecord/lib/active_record/relation/merger.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def merge_multi_values
bind_values = filter_binds(lhs_binds, removed) + rhs_binds bind_values = filter_binds(lhs_binds, removed) + rhs_binds


conn = relation.klass.connection conn = relation.klass.connection
bviter = bind_values.each.with_index bv_index = 0
where_values.map! do |node| where_values.map! do |node|
if Arel::Nodes::Equality === node && Arel::Nodes::BindParam === node.right if Arel::Nodes::Equality === node && Arel::Nodes::BindParam === node.right
(column, _), i = bviter.next substitute = conn.substitute_at(bind_values[bv_index].first, bv_index)
substitute = conn.substitute_at column, i bv_index += 1
Arel::Nodes::Equality.new(node.left, substitute) Arel::Nodes::Equality.new(node.left, substitute)
else else
node node
Expand Down

0 comments on commit 7db835c

Please sign in to comment.