# How to use Rails and REST

**URL:** <https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488>\
**Category:** Rails\
**Created:** [April 22, 2006, 2:49am UTC](https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488 "2006-04-22T02:49:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [April 22, 2006, 2:49am UTC](https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488/1 "2006-04-22T02:49:37Z")

</div>

Hi,

I just wrote an article on how to easily create a REST API for  
Ruby on Rails applications:

[Putting REST on Rails](http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html)

It describes how to create everything from the ground up and includes  
information on testing your API too.

–

Thanks,

Dan K.

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [April 22, 2006, 4:08am UTC](https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488/2 "2006-04-22T04:08:23Z")

</div>

Dan K. wrote:

> Hi,
> 
> I just wrote an article on how to easily create a REST API for  
> Ruby on Rails applications:
> 
> [Putting REST on Rails](http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html)
> 
> It describes how to create everything from the ground up and includes  
> information on testing your API too.
> 
> –
> 
> Thanks,
> 
> Dan K.

Rock solid stuff, did the whole thing. Especially awesome for Code to  
Test Ratio: 1:2.7 which for a tutorial is the most tests I have seen.

One critique is I think it could use a bit of info about REST. I didn’t  
know much about REST before this, so I wasn’t sure why I was doing these  
things. Maybe just a paragraph about the principals and how it uses the  
request types and stuff.

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [April 22, 2006, 9:11am UTC](https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488/3 "2006-04-22T09:11:19Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi Alex,

> > I just wrote an article on how to easily create a REST API for  
> > Ruby on Rails applications:
> > 
> > [Putting REST on Rails](http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html)
> 
> Rock solid stuff, did the whole thing. Especially awesome for Code to  
> Test Ratio: 1:2.7 which for a tutorial is the most tests I have seen.

Thank you. I wanted to provide a set of test cases for a simple  
application so that I could enhance it in further articles, adding  
conditional GET support and supporting HTML and JSON in addition  
to XML. I haven’t written it yet, but I think I can do it with  
maybe 5 to 10 lines of controller code, and maybe a dozen or so  
lines of view and test code.

> One critique is I think it could use a bit of info about REST. I  
> didn’t  
> know much about REST before this, so I wasn’t sure why I was doing  
> these  
> things. Maybe just a paragraph about the principals and how it  
> uses the  
> request types and stuff.

To tell you the truth when I saw the article I was disappointed that  
the part where I gave real world examples of why REST architecture is  
important was edited out. IMHO the article is a little weak without  
it – people need to be told the _why_ behind something before being  
told the _what_.

Ah well, it was my favorite part of the article so I’m posting it  
here anyway 😉 Let me know what you think:

> > The problem was that many applications were designed so that  
> > from side effects. There’s a part of the HTTP specification that  
> > became a standard feature in mainstream browsers someday because  
> > they ever happen.  
> > This would’ve appeared immediately between the second and third  
> > paragraphs of the article. Its a little rough, but I think it  
> > makes the point a little better…

* * *

Thanks,

Dan

* * *

Dan K.  
Autopilot Marketing Inc.

Email: removed\_email\_address@domain.invalid  
Phone: 1 (604) 820-0212  
Web: [http://autopilotmarketing.com/](http://autopilotmarketing.com/)  
vCard: [http://autopilotmarketing.com/~dan.kubb/vcard](http://autopilotmarketing.com/~dan.kubb/vcard)

* * *

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFESdZt4DfZD7OEWk0RAormAJoCDzXsNBvxdwC9VrD15Qq6OABTggCfTmaf  
LQiyipOr41IhGlb2WDspZ0I=  
=gRS5  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [April 22, 2006, 9:54am UTC](https://www.ruby-forum.com/t/how-to-use-rails-and-rest/58488/4 "2006-04-22T09:54:33Z")

</div>

Dan K. wrote:

> > 
> 
> the part where I gave real world examples of why REST architecture is
> 
> > > illustrates a perfect example where going against the grain will  
> > > Accelerator follows those state changing links it causes  
> > > specifications, either intentionally or ignorantly.  
> > > Its not just prefetching we should be thinking about. In the  
> > > paragraphs of the article. Its a little rough, but I think it  
> > > Autopilot Marketing Inc.  
> > > Version: GnuPG v1.4.2.2 (Darwin)
> 
> iD8DBQFESdZt4DfZD7OEWk0RAormAJoCDzXsNBvxdwC9VrD15Qq6OABTggCfTmaf  
> LQiyipOr41IhGlb2WDspZ0I=  
> =gRS5  
> -----END PGP SIGNATURE-----
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Is all the code provided?

–  
Berlin B.  
(ramaza3 on freenode)  
[http://www.newspiritcompany.com](http://www.newspiritcompany.com)  
[http://www.newspiritcompany.com/newforums](http://www.newspiritcompany.com/newforums)  
also checkout alpha version of botverse:  
[http://www.newspiritcompany.com:8086/universe\_home](http://www.newspiritcompany.com:8086/universe_home)
