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. Wow. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 $ curl -X POST -H ''Content-Type: application/xml'' -d \ ''<project> <active>true</active> <description>Bar</description> <name>Foo</name> </project>'' http://localhost:3000/projects (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 Wheeler 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. > > Wow.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Yeah, I''m working on a REST API. 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 "<campaign><name>big traffic jam</ name><category_id>1</category_id><subject>this is the message subject</ subject><body>this is the message body</body></campaign>" http://services.tapiocawireless.com/campaigns What do you mean by ''standard post''? On Oct 7, 8:23 pm, John Wheeler <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > > $ curl -X POST -H ''Content-Type: application/xml'' -d \ > ''<project> > <active>true</active> > <description>Bar</description> > <name>Foo</name> > </project>''http://localhost:3000/projects > > (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 Wheeler > > 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. > > > Wow. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---