diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-19 13:21:18 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-19 13:23:28 -0700 |
commit | 76d7d957900d8fe297c027604ae5d8364b3389d6 (patch) | |
tree | d2672497f447731231f3044ce21f43e1f57ad53c | |
parent | 08848a0035e7b87cc32ec3ca9f8aa0769d6663c7 (diff) | |
download | rails-76d7d957900d8fe297c027604ae5d8364b3389d6.tar.gz rails-76d7d957900d8fe297c027604ae5d8364b3389d6.tar.bz2 rails-76d7d957900d8fe297c027604ae5d8364b3389d6.zip |
Don't mutate bind values in `Relation`
In order to better facilitate refactoring, most places that mutated
`bind_values` have already been removed. One last spot snuck through.
Since we're no longer mutating the array, it also does not need to be
duped in `initialize_copy`.
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index dd78814c6a..9c4db8a05e 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -33,7 +33,6 @@ module ActiveRecord # This method is a hot spot, so for now, use Hash[] to dup the hash. # https://bugs.ruby-lang.org/issues/7166 @values = Hash[@values] - @values[:bind] = @values[:bind].dup if @values.key? :bind reset end diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d6e6cb4d05..1c36d51cd8 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -909,7 +909,7 @@ module ActiveRecord end end - bind_values.reject! { |col,_| col.name == target_value } + self.bind_values = bind_values.reject { |col,_| col.name == target_value } end def custom_join_ast(table, joins) |