13 January 2015

Version Cake is a Ruby gem for the Rails framework. It is meant to provide a drop in solution to version views in your application. The opinion of Version Cake is that you will need to version your resources and the views are the contract to your clients so keeping the versions close to your payloads is important.

The novelty of Version Cake is how it versions: by using the file extension. This is the same way which you’ve always gotten magical routing to templates by action name, request format, locale or other processors (Rails 4.1 also brought a similar, though more generic concept call variants). By dropping in the Version Cake gem you can start versioning specific resources simply by renaming them index.json.jbuilder.v2.

Version Cake follows Rails in convention over configuration: extraction of the request version is done automatically, routing to the appropriate file is handled and a set of typical defaults are set for supported versions. Of course it can all be configured when you are ready for production.

What's Next?

This gem has gotten a small following over the last 2+ years and I think it still fills an important niche. I’ve developed with it on different projects and it’s a great start, but after some time you feel some growing pains. These are pain points I’ve encountered that I think Version Cake can solve:

These are all features that will (hopefully) land for v3.0. I also plan on improving the documentation as one long readme file can be difficult to grok. You can monitor the latest changes for the majority of the work on this branch.

Read more »