diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-05-03 02:24:50 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-05-03 02:24:50 +0000 |
commit | 0c960602fe13a05a787b1cad85d61f8a45b08427 (patch) | |
tree | 2c5fb1248123a97dae98fac3973bd741cc5bfb92 /activerecord/lib/active_record | |
parent | b8e74466cce6216dc89414753bd266a66b643cfb (diff) | |
download | rails-0c960602fe13a05a787b1cad85d61f8a45b08427.tar.gz rails-0c960602fe13a05a787b1cad85d61f8a45b08427.tar.bz2 rails-0c960602fe13a05a787b1cad85d61f8a45b08427.zip |
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
Diffstat (limited to 'activerecord/lib/active_record')
-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 |