From 0c960602fe13a05a787b1cad85d61f8a45b08427 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Thu, 3 May 2007 02:24:50 +0000 Subject: Change Base#to_xml to take the name for a container element for an association from the element name, not the first record's class name. Closes #7004 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/xml_serialization.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3