aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-24 20:02:46 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-24 20:02:46 -0700
commitae8cd56c7b1f3130eb3b8f2632a528a8fc78e56c (patch)
tree5e15051cea065c191c0ad15e65f994c3d802f80a /activerecord/lib/active_record
parentc80487eb1ae7f35cc780745b4f951a79e1a3482b (diff)
downloadrails-ae8cd56c7b1f3130eb3b8f2632a528a8fc78e56c.tar.gz
rails-ae8cd56c7b1f3130eb3b8f2632a528a8fc78e56c.tar.bz2
rails-ae8cd56c7b1f3130eb3b8f2632a528a8fc78e56c.zip
Don't mutate `where_values`
This is to help facilitate future refactorings, as the internal representation is changed. I'm planning on having `where_values` return an array that's computed on call, which means that mutation will have no affect. This is the only remaining place that was mutating (tested by replacing the method with calling `dup`)
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index c34e4bfb9b..53ff48d82e 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -901,7 +901,7 @@ module ActiveRecord
def where_unscoping(target_value)
target_value = target_value.to_s
- where_values.reject! do |rel|
+ self.where_values = where_values.reject do |rel|
case rel
when Arel::Nodes::Between, Arel::Nodes::In, Arel::Nodes::NotIn, Arel::Nodes::Equality, Arel::Nodes::NotEqual, Arel::Nodes::LessThanOrEqual, Arel::Nodes::GreaterThanOrEqual
subrelation = (rel.left.kind_of?(Arel::Attributes::Attribute) ? rel.left : rel.right)