diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-27 23:42:15 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-27 23:42:15 +0900 |
commit | 0605f45ab323331b06dde3ed16838f56f141ca3f (patch) | |
tree | 2ad75bb126c177c4e1ddb612aff56a0562b9e434 /activemodel/test/cases | |
parent | f1878fa06efb2eaa2c521022fa79f95b6c49f865 (diff) | |
parent | 53789f55cd48626e289f130aadd57618d8a73c8a (diff) | |
download | rails-0605f45ab323331b06dde3ed16838f56f141ca3f.tar.gz rails-0605f45ab323331b06dde3ed16838f56f141ca3f.tar.bz2 rails-0605f45ab323331b06dde3ed16838f56f141ca3f.zip |
Merge pull request #28270 from mmangino/dont_ignore_seralization_options
Don't accidentally lose includes in serialization
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/serialization_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/serialization_test.rb b/activemodel/test/cases/serialization_test.rb index 9002982e7f..6826d2bbd1 100644 --- a/activemodel/test/cases/serialization_test.rb +++ b/activemodel/test/cases/serialization_test.rb @@ -174,4 +174,11 @@ class SerializationTest < ActiveModel::TestCase { "name" => "Sue", "email" => "sue@example.com", "gender" => "female" }] } assert_equal expected, @user.serializable_hash(include: [{ address: { only: "street" } }, :friends]) end + + def test_all_includes_with_options + expected = { "email" => "david@example.com", "gender" => "male", "name" => "David", + "address" => { "street" => "123 Lane" }, + "friends" => [{ "name" => "Joe" }, { "name" => "Sue" }] } + assert_equal expected, @user.serializable_hash(include: [address: { only: "street" }, friends: { only: "name" }]) + end end |