Jacob Swanner Development Blog

Announcing RailsDiff (finally)

When upgrading the version of Rails used in an application, it can be difficult to know precisely every detail that should be changed.

Modifying the Rails gem version in your Gemfile and then running bundle update rails seems to work: your tests still pass, application runs like normal, etc. So, you never think twice and go about continuing to develop your application. But, were there other changes that could/should have been made as well? For instance, maybe Rails has changed the default value for some configuration settings, or perhaps new configuration settings have been added since your application was generated.

What the Rails application generator creates is specific to the version of Rails it was generated for. As new versions of Rails are released, what the application generator creates can change; comparing the output of different versions of the generator can give you some understanding of the changes happening in Rails.

Sample diff

Back when Rails 3.1.1 was released, I created a bunch of diffs from the generated code between 3.1.1 and all versions of 3.1.x that came before it. I then put the diffs in gists and wrote a blog post about it. Those gists helped me while I was upgrading a number of applications, because I didn’t need to guess what I should change about my applications configurations, the diffs told me exactly what to change. And, it didn’t just help me, I heard a lot of great feedback from others that those diffs also helped along the way.

Unfortunately, it was tedious and time consuming to create each of those diffs, and that was just creating a dozen of them. So, the thought of creating more of those with each subsequent release of Rails was quite daunting. Automation was definitely going to be needed to keep this going in the long run.

RailsDiff is about what you should change about your application’s configuration when upgrading Rails versions, not about what Rails has changed internally.

To that end, I’ve created RailsDiff. With it, you can see what changes you would need to make to your application’s configuration when upgrading from your current version of Rails to the new version of your choosing.

I say in the title that I’m finally announcing RailsDiff, and that’s because the site has been up and running for just over a year. Admittedly, I’m a little late with this announcement, but I hope it can help you the next time you need to upgrade a Rails application.