33, :Versailles => 3231}.to_xml I get ...">

To_xml gives strange results

When i do it

{"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 expect the rails to decrypt New York, no?

+5
source share
3 answers

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

Spaces will now be decrypted (and the _dasherize private method will be expanded to handle spaces.)

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

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

Thanks for putting up this beacon ticket and the stack question (which added more info in the discussions); with the help of all the information provided, I was able to complete my first rails!

+2
source

I see the same thing too.

:dasherize to_xml .

. [...] : only,: except,: skip_instruct,: skip_types,: dasherize : camelize [...] dasherize , : dasherize to false. : camelize to true - : dasherize.

, :

asdf.to_xml(:dasherize => true)

, :camelize .

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

, , - " ".

0

, #to_xml .

0

All Articles