diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-28 12:53:48 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-29 13:41:38 -0200 |
commit | e8c360527d22b6299d28e5b6784c4af74537eef2 (patch) | |
tree | a0e5573da44872e3d996f58512e4c8d0a123a1e4 /activemodel/lib | |
parent | 66e87b714b406a25af60156a1fa15d1ebb99a0bd (diff) | |
download | rails-e8c360527d22b6299d28e5b6784c4af74537eef2.tar.gz rails-e8c360527d22b6299d28e5b6784c4af74537eef2.tar.bz2 rails-e8c360527d22b6299d28e5b6784c4af74537eef2.zip |
Merge pull request #8352 from steveklabnik/update_7858
Specify type of singular assication during serialization
Conflicts:
activemodel/CHANGELOG.md
activemodel/test/cases/serializers/xml_serialization_test.rb
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/serializers/xml.rb | 7 |
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 |