aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/serializers')
-rw-r--r--activemodel/lib/active_model/serializers/xml.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb
index 2dc7d00f52..a63856045f 100644
--- a/activemodel/lib/active_model/serializers/xml.rb
+++ b/activemodel/lib/active_model/serializers/xml.rb
@@ -144,7 +144,12 @@ module ActiveModel
end
else
merged_options[:root] = association.to_s
- records.to_xml(merged_options)
+
+ unless records.class.to_s.underscore == association.to_s
+ merged_options[:type] = records.class.name
+ end
+
+ records.to_xml merged_options
end
end