Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

to_xml giving strange results

When I do that

{"New York"=>33, :Versailles => 3231}.to_xml

I get

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<hash>
  <Versailles type=\"integer\">3231</Versailles>
  <New York type=\"integer\">33</New York>
</hash>

I would have expected rails to dasherize "New York", no?

like image 983
standup75 Avatar asked Nov 06 '22 04:11

standup75


1 Answers

This issue is closed via the merging of pull request 445 : https://github.com/rails/rails/pull/445

Spaces will now be dasherized (and the private _dasherize method is enhanced to handle spaces.)

{"New York"=>33}.to_xml will result in

..<New-York type=\"integer\">33</New-York>..

Thanks for putting up this lighthouse ticket & the stackoverflow question (which added more info in the discussions); with the help of all the information provided, I was able to make my first rails commit!

like image 50
Prakash Murthy Avatar answered Nov 09 '22 02:11

Prakash Murthy