Jeremy Smith's blog

Entry Is Labelled

Rough RESTing on Rails

Rails Framework not very RESTful


  1. gravatar

    I don't think the problem is as severe as he suggests. Maybe that's because lately, my Rails coding style involves heavy use of routes.rb to map (RESTful) URIs onto Rails controllers and actions. I don't see this as sub-optimal, because the decoupling between URIs and code allows for each to be organized in the way that makes most sense.

    For example, take a bookstore application (OK, so I'm not feeling very original today). The RESTful URIs might be things like "/author/Isaac_Asimov", "/genre/Science_Fiction", and so on. The URIs are very different, but the operations are similar. So I make a BookListController that has methods like filter_by_author, filter_by_genre, and so on that share common code and/or templates, and then use routes.rb to map the URIs onto this controller.