ReSTfull route conventions

I have a question regarding restful routing and the uri conventions
presently in use, specifically the /new and /{id}/edit uri’s.

I have been giving these two some thought and it seems to me that there
exists a cleaner approach to this then simply tacking on a procedure
call to the end of the uri.


http://localhost:3000/clients/new with http://localhost:3000/client

:method => ‘get’ followed by a ‘post’


http://localhost:3000/clients/1/edit with http://localhost:3000/client/1

:method => ‘get’ followed by a ‘put’

In both cases the use of the singular creates a unique mapping of the
underlying http verb (get) to the Rails methods ‘new’ and ‘edit’
respectively. There remains the self-evident problem of dealing with
nouns that share plural and singular forms, a sheep versus a flock of
sheep for instance. However, I believe that this issue could, and
probably should, be circumvented by a careful choice of terminology.

So, why did Rails elect to use the rpc style for just new and edit
rather than inferencing the action from the base resource uri?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs