Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4794

Show
Ignore:
Timestamp:
08/20/06 14:38:58 (2 years ago)
Author:
bitsweat
Message:

to_xml: correct naming of included associations. Closes #5831.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r4792 r4794  
    11*SVN* 
     2 
     3* to_xml: correct naming of included associations.  #5831 [josh.starcher@gmail.com] 
    24 
    35* Pushing a record onto a has_many :through sets the association's foreign key to the associate's primary key and adds it to the correct association.  #5815, #5829 [josh@hasmanythrough.com] 
  • trunk/activerecord/lib/active_record/xml_serialization.rb

    r4652 r4794  
    191191 
    192192              builder.tag!(tag) do 
    193                 records.each { |r| r.to_xml(opts) } 
     193                records.each { |r| r.to_xml(opts.merge(:root => association.to_s.singularize)) } 
    194194              end 
    195195            end 
  • trunk/activerecord/test/base_test.rb

    r4770 r4794  
    13201320    assert xml.include?(%(<title>The Second Topic's of the day</title>)) 
    13211321  end 
     1322 
     1323  def test_array_to_xml_including_has_many_association 
     1324    xml = [ topics(:first), topics(:second) ].to_xml(:indent => 0, :skip_instruct => true, :include => :replies) 
     1325    assert xml.include?(%(<replies><reply>)) 
     1326  end 
    13221327   
    13231328  def test_array_to_xml_including_has_one_association