diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/xml_serialization.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/xml_serialization.rb b/activerecord/lib/active_record/xml_serialization.rb index e256135205..c3a39fc49d 100644 --- a/activerecord/lib/active_record/xml_serialization.rb +++ b/activerecord/lib/active_record/xml_serialization.rb @@ -204,11 +204,11 @@ module ActiveRecord #:nodoc: when :has_many, :has_and_belongs_to_many records = @record.send(association).to_a unless records.empty? - tag = records.first.class.to_s.underscore.pluralize + tag = association.to_s tag = tag.dasherize if dasherize? builder.tag!(tag) do - records.each { |r| r.to_xml(opts.merge(:root => association.to_s.singularize)) } + records.each { |r| r.to_xml(opts.merge(:root=>r.class.to_s.underscore)) } end end when :has_one, :belongs_to |