This project is archived and is in readonly mode.
Array#to_xml accepts :root_attrs
-
Luismi Cavallé
+1 Useful patch, tests pass and docs
-
Emili Parreño
+1 Tests and docs ok
-
Deleted User
+1, everything ok and is useful
-
DHH
- State changed from new to wontfix
The problem is that there won't parity with Hash.from_xml, which is the sister method of to_xml. If you give it your sample string, you'll get {"projects"=>[{"name"=>"project 1"}, {"name"=>"project 2"}, {"name"=>"project 3"}]} back -- in other words, the attributes are just dropped.
Until we find a way of dealing with that, I don't see this as a good fit.
-
Ernesto Jiménez
It actually seems that the problem is with the type="array".
omitting type="array" gets the parameters.
A possible solution might be avoiding type="array" when :root_attrs is set?
