aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorMike Mangino <mmangino@hubtran.com>2017-03-03 15:02:35 -0500
committerMike Mangino <mmangino@hubtran.com>2017-03-03 15:02:35 -0500
commit1bb0605dfe09f654d9ad43a86b69183cd6f653f2 (patch)
treeb140192eeb3fadc1628d627f008602c560cc2f04 /activemodel/lib
parent76be78c59cd75eaafb31719745b43df4743fd33d (diff)
downloadrails-1bb0605dfe09f654d9ad43a86b69183cd6f653f2.tar.gz
rails-1bb0605dfe09f654d9ad43a86b69183cd6f653f2.tar.bz2
rails-1bb0605dfe09f654d9ad43a86b69183cd6f653f2.zip
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 77834f26fc..78e46c49eb 100644
--- a/activemodel/lib/active_model/serialization.rb
+++ b/activemodel/lib/active_model/serialization.rb
@@ -177,7 +177,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|