Created
May 14, 2011 02:34
-
-
Save AquaGeek/971774 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #6406
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/activerecord/lib/active_record/serializers/xml_serializer.rb b/activerecord/lib/active_record/serializers/xml_serializer.rb | |
index 9bf1193..ae6f15a 100644 | |
--- a/activerecord/lib/active_record/serializers/xml_serializer.rb | |
+++ b/activerecord/lib/active_record/serializers/xml_serializer.rb | |
@@ -252,7 +252,9 @@ module ActiveRecord #:nodoc: | |
end | |
else | |
if record = @record.send(association) | |
- record.to_xml(opts.merge(:root => association)) | |
+ association_name = association.to_s.singularize | |
+ record_class = (record.class.to_s.underscore == association_name) ? nil : record.class.name | |
+ record.to_xml(opts.merge(:root => association, :type => record_class)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment