Is Rails moving to a pure RESTful design? I don’t like REST but love
Rails. I’d hate to think that as Rails develops it will become more
difficult to use it RESTlessly.
After moving to Rails 2 a few months ago I’ve been looking to create new
elements of my applications using the newer RESTful techniques and the
more I try, the more I dislike the way it works.
The final screw in the coffin for me was when I scaffolded a new
controller (I was in a hurry and needed to get something working
quickly). I noticed that each action had a comment above it showing the
URL path-component that would take the user to each action. That summed
up for me what I don’t like about the new REST based system - I don’t
want the choice of action to be something I have to think about.
With the old style ‘controller\action\id’ URL it was simple for me to
work out which action in the controller I was using. With the newly
favoured system I have to keep asking myself “is this a get or a post”.
The fact that the writers of the scaffold code felt they had to add
reminders above each action, suggests to me that others find that it is
not intuitive as to which action is being used at each point.
I think the new URLs go against one of my goals of writing self
commenting code whenever possible (one of the reasons I like Ruby so
much as it makes that easy).
At the moment it is easy stop the RESTful stuff. Just don’t add the
‘map.resources :controller_name’ statement into routes.rb (or remove
that statement if scaffolding puts it in for you). However, I can see a
point when it’s asked “why do we have to keep adding these statements to
routers.rb? Why don’t we just assume a controller will be RESTful?”.
Then suddenly the choice of whether to be RESTful or not could
disappear.
I think it is fine that other developers want to create RESTful
application and can do so easily with Rails. If it works for them …
However, I’d hate for Rails to develop to the point where the decision
is no longer available to the developer as to whether or not to be
RESTful.
As a RESTless Luddite I hope that Rails doesn’t become REST only.