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/test/cases/scoping | |
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/test/cases/scoping')
-rw-r--r-- | activerecord/test/cases/scoping/default_scoping_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb index 89fb434b27..e310739f7b 100644 --- a/activerecord/test/cases/scoping/default_scoping_test.rb +++ b/activerecord/test/cases/scoping/default_scoping_test.rb @@ -342,6 +342,11 @@ class DefaultScopingTest < ActiveRecord::TestCase assert_equal "Aaron", aaron.name end + def test_create_with_using_both_string_and_symbol + jamis = PoorDeveloperCalledJamis.create_with(name: "foo").create_with("name" => "Aaron").new + assert_equal "Aaron", jamis.name + end + def test_create_with_reset jamis = PoorDeveloperCalledJamis.create_with(name: "Aaron").create_with(nil).new assert_equal "Jamis", jamis.name |