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

Changeset 4652

Show
Ignore:
Timestamp:
08/03/06 17:19:45 (2 years ago)
Author:
david
Message:

Fixed to_xml with :include misbehaviors when invoked on array of model instances (closes #5690) [alexkwolfe@gmail.com]

Files:

Legend:

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

    r4651 r4652  
    11*SVN* 
     2 
     3* Fixed to_xml with :include misbehaviors when invoked on array of model instances #5690 [alexkwolfe@gmail.com] 
    24 
    35* Added support for conditions on Base.exists? #5689 [josh@joshpeek.com]. Examples: 
  • trunk/activerecord/lib/active_record/xml_serialization.rb

    r4431 r4652  
    200200          end 
    201201        end 
     202 
     203        options[:include] = include_associations 
    202204      end 
    203205    end 
  • trunk/activerecord/test/base_test.rb

    r4646 r4652  
    13001300    assert xml.include?(%(<title>The Second Topic's of the day</title>)) 
    13011301  end 
     1302   
     1303  def test_array_to_xml_including_has_one_association 
     1304    xml = [ companies(:first_firm), companies(:rails_core) ].to_xml(:indent => 0, :skip_instruct => true, :include => :account) 
     1305    assert xml.include?(companies(:first_firm).account.to_xml(:indent => 0, :skip_instruct => true)) 
     1306    assert xml.include?(companies(:rails_core).account.to_xml(:indent => 0, :skip_instruct => true)) 
     1307  end 
     1308 
     1309  def test_array_to_xml_including_belongs_to_association 
     1310    xml = [ companies(:first_client), companies(:second_client), companies(:another_client) ].to_xml(:indent => 0, :skip_instruct => true, :include => :firm) 
     1311    assert xml.include?(companies(:first_client).to_xml(:indent => 0, :skip_instruct => true)) 
     1312    assert xml.include?(companies(:second_client).firm.to_xml(:indent => 0, :skip_instruct => true)) 
     1313    assert xml.include?(companies(:another_client).firm.to_xml(:indent => 0, :skip_instruct => true)) 
     1314  end 
    13021315 
    13031316  def test_to_xml_including_belongs_to_association