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/lib | |
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/lib')
-rw-r--r-- | activemodel/lib/active_model/serialization.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb index 47cb81bee5..c4b7b32291 100644 --- a/activemodel/lib/active_model/serialization.rb +++ b/activemodel/lib/active_model/serialization.rb @@ -179,7 +179,7 @@ module ActiveModel return unless includes = options[:include] unless includes.is_a?(Hash) - includes = Hash[Array(includes).map { |n| n.is_a?(Hash) ? n.to_a.first : [n, {}] }] + includes = Hash[Array(includes).flat_map { |n| n.is_a?(Hash) ? n.to_a : [[n, {}]] }] end includes.each do |association, opts| |