diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-09-04 14:40:10 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-09-04 14:40:19 -0700 |
commit | 2e6625fb775783cdbc721391be18a073a5b9a9c8 (patch) | |
tree | e9291b495ad9875fbbbeea0d0f5952a7b57250fa /activerecord/lib | |
parent | c523b7c468ee9512d82243636bfac321e79535db (diff) | |
download | rails-2e6625fb775783cdbc721391be18a073a5b9a9c8.tar.gz rails-2e6625fb775783cdbc721391be18a073a5b9a9c8.tar.bz2 rails-2e6625fb775783cdbc721391be18a073a5b9a9c8.zip |
always reorder bind parameters. fixes #15920
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index e59cce6934..e6a088d07e 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -879,12 +879,10 @@ module ActiveRecord arel.lock(lock_value) if lock_value # Reorder bind indexes if joins produced bind values - if arel.bind_values.any? - bvs = arel.bind_values + bind_values - arel.ast.grep(Arel::Nodes::BindParam).each_with_index do |bp, i| - column = bvs[i].first - bp.replace connection.substitute_at(column, i) - end + bvs = arel.bind_values + bind_values + arel.ast.grep(Arel::Nodes::BindParam).each_with_index do |bp, i| + column = bvs[i].first + bp.replace connection.substitute_at(column, i) end arel |