Hi. What''s beautiful about Rails is that it provides the incredibly easy system for API building. At the same time once you grow and production test the application you start finding that you can make the API interface even better. But you have to break backward compatibility. How do you handle this situation? I was initially planning something like DNS versioning and multiple rails deployments (api01.startup.com, api05.startup.com). This plan won''t work anymore since there are cases when we will controlling the code, but not the deployment server and DNS setup. What''s the best way to implement API versioning in rails? -- M.
> What''s the best way to implement API versioning in rails? >With routing. Start off with api.startup.com/v1/session/create, then move on to api.startup.com/v2/session/create, etc. - D -- Posted via http://www.ruby-forum.com/.
> With routing. > > Start off with api.startup.com/v1/session/create, then move on to > api.startup.com/v2/session/create, etc. >Interesting. That would be a pretty solution. What''s the best way to provide backwards compatibility using this model? Should I have XML views that implement: if version1 do this else do that -- M.
> What''s the best way to provide backwards compatibility using this > model? Should I have XML views that implement: > if version1 > do this > else > do thatI like to avoid code in views- how about separate templates, like app/views/session/v1/create.xml.erb and app/views/session/v2/create.xml.erb? - D -- Posted via http://www.ruby-forum.com/.