Thursday, November 15, 2007

RESTful Rails: Anorexic Controllers and Fat Models

It is scary how thin and lean Rails controllers become after you RESTify them (shudder). I love refactoring, but this morning, as I sat down for my morning ritual of refactoring previous day's code, I figured I couldn't! There just wasn't any extra sliver of code to be mercilessly chopped off from our bright and shiny RESTful controllers. Background: our application Guitarati is being created completely using Ruby on Rails and this week, I put our current code to REST.

I am going through a love-hate relationship with REST. My emotions are swinging wildly for and against this pithy thing. May be because I am commitment-phobic. May be I don't want to tie myself down to a design philosophy just yet. May be because I've not seen 30 summers in my life. Sometimes, REST feels like a strait-jacketed approach that curbs creative design (try Ajax + nested routes). And at other times, it feels like a God-send to bring order to the Universe (just look at your controller code).

Nonetheless, here are some resources for those aiming for a RESTful lifestyle. (better sleep, less worries and more cash)


2. Taming the RESTful BEAST (a whole working RESTful application from the good guys). And a nice diagram explaining the app.


4. Those with some extra cash can pay $9 and watch the RESTful show. Mind you, this talks of REST before Rails 1.2 came out, so I'm not sure if this will be up-to-date vis-a-vis Rails 2.0 preview.

PS: the loving-REST personality of mine wanted to title the post as 'RESTful Rails: Lean Controllers and Mean Models', but you know who won in the end. For the puritans: I despise anorexia as much as you guys do and I have nothing against fat people.

0 comments: