Just like I can post a form to my controller and have it deserialize
into a ruby object, I can also post xml to my controller and it
deserialize into my ruby object. And all I had to do was set the
appropriate content-type.
Yes. This is cool, and it is funny because I just created an account
with ruby-forum for the sole purpose of finding out how this is done
under the hood, and your post is the latest in the list as of this…
I imagine you are doing some REST development like I am.
Can someone please explain to me or point me in the right direction why
(notice the content-type explicitly set) serializes the XML into a Hash
while a standard post does not? The magic is too mind-boggling for me to
grok…
John W.
eggie5 wrote:
This is super cool.
Just like I can post a form to my controller and have it deserialize
into a ruby object, I can also post xml to my controller and it
deserialize into my ruby object. And all I had to do was set the
appropriate content-type.
I’m still in awe about how it was just handled automatically… I
figured that AT LEAST, somewhere down the line, I’d have to call
MyObject.new.from_xml… but no…
This is the example I give with curl:
curl -H “Content-Type: text/xml” -d “big traffic jam</
name><category_id>1</category_id>this is the message subject</
subject>this is the message body” http://services.tapiocawireless.com/campaigns