Added XML attributes dropped by Rails?
echo '<request><item attribute="foo">bar</item></request>' | curl -X POST -H 'Content-type: application/xml' -d @- http://10.0.1.51:3000/baz/evaluate
My Rails application forgets all about the attribute when it receives the hosted XML.
Processing BazController#evaluate (for 10.0.1.3 at 2009-10-03 18:29:32) [POST]
Parameters: {"request"=>{"item"=>"bar"}}
Any idea what I am doing wrong?
+2
Brad beattie
source
to share
2 answers
Considering Hash.from_xml
you're not very smart, you might want to try grabbing the raw XML before Rails goes with it. From the controller, you can do request.raw_post
. I think you will get what you want, although there is another similar method that may be better suited. Once you get the raw XML, you can parse it yourself.
+1
source to share