Marcelo de Moraes Serpa
2008-Jul-30 18:59 UTC
Augmenting RESTful routes to make it more informative
Everyone knows that the trend is RESTful design. The simplicity of REST means that if makes it easier to create bigger and more complex object models. As a side effect, you have your RESTful routes/URLs, which reflect the simplicity and consistency of the RESTful design. It is natural to model your URLs after your objects, object hierarchies instead of actions (the actions being the HTTP verbs). RESTful route: /events/3 However, sometimes there are specific routes that don''t really fit into the RESTful way of doing things but are useful nonetheless. For example: /events/04/06/2007/3 This url adds a prefix date to the event/events. Besides allowing the user to list all of the events of a specific date, it is also very informative. Having this additional piece of information in a google search result can sometimes be a timesaver (you can be more certain that it is the event you are searching, since the one you went to also happened on this date). I don''t know if this date could be re-factored into a resource. The way I''m doing this is customizing the default events resource RESTful route to have this prefix. Do you have such custom URLs in your app? Would you mind sharing your thoughts and experiences? Thanks in advance, Marcelo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---