I'm using ActiveSupport's to_xml to generate some xml from a hash.
I have need for the this ruby:
:Shipment => {
:Packages => [
{:weight => '5', :type => 'box'},
{:weight => '3', :type => 'tube'}
]
}
To generate this xml:
<Shipment>
<Package>
<weight>5</weight>
<type>box</type>
</Package>
<Package>
<weight>3</weight>
<type>tube</type>
</Package>
</Shipment>
But instead, it wraps the array in another set of xml tags like this:
<Shipment>
<Packages>
<Package>
<weight>5</weight>
<type>box</type>
</Package>
<Package>
<weight>3</weight>
<type>tube</type>
</Package>
</Packages>
</Shipment>
Please don't tell me I need to change my xml structure... It's how UPS says to do it :(
Anybody know a work-around?