This project is archived and is in readonly mode.
Hash.from_xml fieldnames uncamelizing
-
marktucks
I tried this in script/console and got the following output?
xml = %(<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>) => "<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>" h = Hash.from_xml(xml) => {"blah_blah"=>" 1 2 "}
It doesn't seem to have the Junk entries and has removed the <dasherized_tag>s
-
marktucks
Apologies for the formatting.
@@@ruby xml = %(<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>) => "<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>" h = Hash.from_xml(xml) => {"blah_blah"=>" 1 2 "}
-
Gregg Kellogg
It would probably help if i used the whole test string:
xml = %(<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>)
-
Gregg Kellogg
Oops! It seems that it's getting eaten on the submit. I'll modify the appropriate unit test and upload it.
-
Gregg Kellogg
See if this works.
@@@ruby xml = %(<blah_blah> 1 2 <dasherized_tag> 3 </dasherized_tag> </blah_blah>)
-
Gregg Kellogg
Okay, here's an updated activesupport/test/core_ext/hash_ext_test.rb with new test test_single_record_from_xml_with_camel_case
-
Gregg Kellogg
- Assigned user set to Jeremy Kemper
Seems to have been fixed in commit eb201e64c0b68aee6d0715d44cf48178204c4133 "Fixed Hash#from_xml with keys that are all caps."
-
Denis
The constant changing of Hash#from_xml in re: camelCase tags is very confusing. I filed https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets..., mainly as a way to ask that the correct & intended behavior be documented (and then I'd be happy to add a unit test for it).
-
Mike Grafton
+1 for what Denis said. Also please see my comment on issue #3377
-
David Trasbo
- State changed from new to resolved
Fixed in http://github.com/rails/rails/commit/eb201e64c0b68aee6d0715d44cf481...
Further discussion regarding
Hash.from_xmlis referred to #3377 Hash#from_xml converted camelCase to underscore in 2.3.2, doesn't in 2.3.4.
