diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-13 07:14:59 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-16 15:38:49 +0900 |
commit | 01c85097d4977b0c141b7c89df15c0750f37c62d (patch) | |
tree | 301350f925e10f533c75923585a0f84d99828897 /activerecord/lib/active_record/relation | |
parent | 189b8a06dc703f7a8477f877f0a02e23dd691ed8 (diff) | |
download | rails-01c85097d4977b0c141b7c89df15c0750f37c62d.tar.gz rails-01c85097d4977b0c141b7c89df15c0750f37c62d.tar.bz2 rails-01c85097d4977b0c141b7c89df15c0750f37c62d.zip |
Fix `create_with` using both string and symbol
This is related with #27680.
Since `where_values_hash` keys constructed by `where` are string, so we
need `stringify_keys` to `create_with_value` before merging it.
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/where_clause.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 79495ead91..9d6db3dc64 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -797,7 +797,7 @@ module ActiveRecord value = sanitize_forbidden_attributes(value) self.create_with_value = create_with_value.merge(value) else - self.create_with_value = {} + self.create_with_value = FROZEN_EMPTY_HASH end self diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 119910ee79..0feb2c6cb2 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -52,8 +52,8 @@ module ActiveRecord binds = self.binds.map { |attr| [attr.name, attr.value] }.to_h equalities.map { |node| - name = node.left.name - [name, binds.fetch(name.to_s) { + name = node.left.name.to_s + [name, binds.fetch(name) { case node.right when Array then node.right.map(&:val) when Arel::Nodes::Casted, Arel::Nodes::Quoted |