diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-01 05:20:00 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-01 05:26:35 +0900 |
commit | bde0041f0a47a6b252852d7c49f4d3f75a29bc70 (patch) | |
tree | c52e8e4a15e15a98f68db843286cb364ac966545 /activerecord/test/cases/associations/has_many_through_associations_test.rb | |
parent | e4c6a84fb15c7856b66d8fb478d396d68ba50c34 (diff) | |
download | rails-bde0041f0a47a6b252852d7c49f4d3f75a29bc70.tar.gz rails-bde0041f0a47a6b252852d7c49f4d3f75a29bc70.tar.bz2 rails-bde0041f0a47a6b252852d7c49f4d3f75a29bc70.zip |
Add test case for `collection_singular_ids` with symbol primary keys
This is a regression test for #27864.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 046020e310..7c9c9e81ab 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -869,6 +869,14 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert_equal [dev], company.developers end + def test_collection_singular_ids_setter_with_required_type_cast + company = companies(:rails_core) + dev = Developer.first + + company.developer_ids = [dev.id.to_s] + assert_equal [dev], company.developers + end + def test_collection_singular_ids_setter_with_string_primary_keys assert_nothing_raised do book = books(:awdr) |