This project is archived and is in readonly mode.

#672 ✓resolved
David Burger

activesupport's to_xml shouldn't modify options hash

Reported by David Burger | July 22nd, 2008 @ 06:04 AM

This patch changes the to_xml core extensions for Array and Hash so that they dup the options hash instead of modifying the passed in version. The current behavior, as demonstrated in script/console, looks like this:

>> options = {:skip_instruct => true}
=> {:skip_instruct=>true}
>> [].to_xml(options)
=> "<nil-classes type=\"array\"/>\n"
>> options
=> {:builder=><nil-classes type="array"/>
<inspect/>
, :indent=>2}
>> 

Notice the options hash has been modified by the to_xml call. With included patch, the options hash is not modified:

>> options = {:skip_instruct => true}
=> {:skip_instruct=>true}
>> [].to_xml(options)
=> "<nil-classes type=\"array\"/>\n"
>> options
=> {:skip_instruct=>true}

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages