aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJohn Hawthorn <john@stembolt.com>2017-03-20 14:55:53 -0700
committerJohn Hawthorn <john@stembolt.com>2017-03-20 15:52:35 -0700
commit19dc69cb07572f8b17ae15c8bc0b5a29bc8a281f (patch)
tree16ba6bc1a19644ff748512bcf079a9c8834e7743 /activerecord/lib
parent5c0d00072d1309dbc77bb5d97e42956bac3e8684 (diff)
downloadrails-19dc69cb07572f8b17ae15c8bc0b5a29bc8a281f.tar.gz
rails-19dc69cb07572f8b17ae15c8bc0b5a29bc8a281f.tar.bz2
rails-19dc69cb07572f8b17ae15c8bc0b5a29bc8a281f.zip
Fix where_clause#except with specific where value
Fixes a regression introduced in 22ca710f20c3c656811df006cbf1f4dbc359f7a6 where Relation#unscope with a specific where value (vs unscoping the entire where clause) could result in the wrong binds being left on the query. This was caused by an index variable not being incremented properly.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/where_clause.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb
index 417b24c7bb..119910ee79 100644
--- a/activerecord/lib/active_record/relation/where_clause.rb
+++ b/activerecord/lib/active_record/relation/where_clause.rb
@@ -148,10 +148,10 @@ module ActiveRecord
(binds_index...(binds_index + binds_contains)).each do |i|
except_binds[i] = true
end
-
- binds_index += binds_contains
end
+ binds_index += binds_contains if binds_contains
+
except
end