aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-28 12:53:48 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-28 12:53:48 -0800
commit4c99d0870c87e136b257e03fffdfc5f86c60ff34 (patch)
tree1425af43e28d27d31b9781b495eba9e65105fe6e /activemodel/lib
parent5f1595633c2e9eca2802936b3905490264ebe688 (diff)
parent9504b44cf60c1d69519cef32465f46a73719bc17 (diff)
downloadrails-4c99d0870c87e136b257e03fffdfc5f86c60ff34.tar.gz
rails-4c99d0870c87e136b257e03fffdfc5f86c60ff34.tar.bz2
rails-4c99d0870c87e136b257e03fffdfc5f86c60ff34.zip
Merge pull request #8352 from steveklabnik/update_7858
Specify type of singular assication during serialization
Diffstat (limited to 'activemodel/lib')
-rwxr-xr-xactivemodel/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 fb6093cce5..4a17a63e20 100755
--- a/activemodel/lib/active_model/serializers/xml.rb
+++ b/activemodel/lib/active_model/serializers/xml.rb
@@ -149,7 +149,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