aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-02-27 23:42:15 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-02-27 23:42:15 +0900
commit0605f45ab323331b06dde3ed16838f56f141ca3f (patch)
tree2ad75bb126c177c4e1ddb612aff56a0562b9e434 /activemodel/lib
parentf1878fa06efb2eaa2c521022fa79f95b6c49f865 (diff)
parent53789f55cd48626e289f130aadd57618d8a73c8a (diff)
downloadrails-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.rb2
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|