From ae8cd56c7b1f3130eb3b8f2632a528a8fc78e56c Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 24 Jan 2015 20:02:46 -0700 Subject: 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`) --- activerecord/lib/active_record/relation/query_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3