On Oct 24, 3:20 pm, Marcelo Barbudas <[email protected]> wrote: > Hi, > > I've been trying to implement a versioned API, I went through > different versions that I didn't like. > > I am wondering if I can do something like this with routes, and if > it's possible how can it be implemented: > > api.example.com/items/show.xml works, no version > api.example.com/v1/items/show.xml works, v1 > api.example.com/v2/items/show.xml works, v2 > > Basically I am wondering if Rails Routing (or rack) can detect "v1" or > "v2" and set a params[:version] variable, and then proceed as that > string is not there (regular routing).
Why don't you try api.example.com/items/show.xml apiv1.example.com/items/show.xml apiv2.example.com/items/show.xml This way you won't need to mess up with the :version param in the code--just install separate versions and route them through the web server. Hope this helps. -- Alex --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

