# Praises to Rails!

**URL:** <https://www.ruby-forum.com/t/praises-to-rails/116626>\
**Category:** Rails\
**Created:** [October 8, 2007, 4:56am UTC](https://www.ruby-forum.com/t/praises-to-rails/116626 "2007-10-08T04:56:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [October 8, 2007, 4:56am UTC](https://www.ruby-forum.com/t/praises-to-rails/116626/1 "2007-10-08T04:56:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [October 8, 2007, 5:23am UTC](https://www.ruby-forum.com/t/praises-to-rails/116626/2 "2007-10-08T05:23:58Z")

</div>

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   
‘  
true  
Bar  
Foo  
’ [http://localhost:3000/projects](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 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.
> 
> Wow.

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [October 8, 2007, 9:53pm UTC](https://www.ruby-forum.com/t/praises-to-rails/116626/3 "2007-10-08T21:53:02Z")

</div>

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 “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](http://services.tapiocawireless.com/campaigns)

What do you mean by ‘standard post’?

On Oct 7, 8:23 pm, John W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
