diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-08-30 19:41:12 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-08-30 19:41:12 -0700 |
commit | a3dd738c38df634a46a2261a0de27fd31de7ae51 (patch) | |
tree | 86663829cc077177182237e203acee0ffbe8084d /activerecord | |
parent | baf5f47b8768c7ec0164ed5ab60e369cdd936d71 (diff) | |
parent | 7db835c9f98ee6cc536d0304a5f7a9965efc86cb (diff) | |
download | rails-a3dd738c38df634a46a2261a0de27fd31de7ae51.tar.gz rails-a3dd738c38df634a46a2261a0de27fd31de7ae51.tar.bz2 rails-a3dd738c38df634a46a2261a0de27fd31de7ae51.zip |
Merge pull request #12090 from njakobsen/merger-performance
[Performance] Don't create fibers while merging bind variables
Diffstat (limited to 'activerecord')
-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 c08158d38b..530c47d0d0 100644 --- a/activerecord/lib/active_record/relation/merger.rb +++ b/activerecord/lib/active_record/relation/merger.rb @@ -107,11 +107,11 @@ module ActiveRecord bind_values = filter_binds(lhs_binds, removed) + rhs_binds conn = relation.klass.connection - bviter = bind_values.each.with_index + bv_index = 0 where_values.map! do |node| if Arel::Nodes::Equality === node && Arel::Nodes::BindParam === node.right - (column, _), i = bviter.next - substitute = conn.substitute_at column, i + substitute = conn.substitute_at(bind_values[bv_index].first, bv_index) + bv_index += 1 Arel::Nodes::Equality.new(node.left, substitute) else node |