1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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`)
This commit is contained in:
Sean Griffin 2015-01-24 20:02:46 -07:00
parent c80487eb1a
commit ae8cd56c7b

View file

@ -901,7 +901,7 @@ module ActiveRecord
def where_unscoping(target_value) def where_unscoping(target_value)
target_value = target_value.to_s target_value = target_value.to_s
where_values.reject! do |rel| self.where_values = where_values.reject do |rel|
case 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 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) subrelation = (rel.left.kind_of?(Arel::Attributes::Attribute) ? rel.left : rel.right)