Blog

Rails 6 is Here! What You Should Know and When to Upgrade.

Gavin Terpstra
August 28, 2019

Rails 6 is Released, Tested and Ready for Use.

Here’s the summary from DHH on what’s included:

“Dealing with incoming email, composing rich-text content, connecting to multiple databases, parallelising test runs, integrating JavaScript with love, and rewriting the code loader. These are fundamental improvements to the fundamentals of working with the web and building fast and fresh applications. This is the kind of work we’ve been doing for the past fifteen years, and we’re still at it. THIS IS RAILS SIX!” …

“While we took a little while longer with the final version than expected, the time was spent vetting that Rails 6 is solid. In fact, GitHub, Shopify, and Basecamp, as well as plenty of other companies and applications, have been running the pre-release version of Rails 6 for months and months in production. We might not have caught everything, but if it’s good enough for GitHub, Shopify, and Basecamp, it’s probably good enough for you too!” - DHH, Ruby on Rails Creator

No point repeating everything he said, you can read the full post here. But what does this mean for existing users?

New Toys!

There are plenty of new tools for developers to work with and speed up their development. As covered above; many applications these days require rich text editing, and we’re particularly happy to see Action Mailbox, given our founder’s personal history contributing to Rails’ email functionality.

But it’s not just about having shiny new toys to play with. In real terms, like most of the new additions to Rails, the ‘toys’ are time-saving functions for your developers; time spent upgrading to new versions may well be saved with future feature development. Read that as: you not having to reinvent the wheel when developing new features. Don’t forget - shiny new bits for your developers may even increase their happiness!

Make Sure Your Test Coverage is Adequate

Before you get started on any upgrade (and really, you should have this before any major development on your app), make sure your test suite is up-to-date.
This is really important. This is REALLY important.

When upgrading you need to know if the changes you’ve made are going to create problems in other parts of your app, ranging from small things, such as labels not displaying, to entire pages not loading. Realistically, you can expect things to break with any upgrade. The virtue of tests is that they tell you where the breakages are, so your customers don’t.

Here’s a guide on what testing is adequate.

Are your Gems Ready for the Update?

Your application likely relies on other libraries of code, known as “Gems” to provide functionality, such as file uploads, user authentication, etc. Sometimes the maintainers of these gems can take a while to make the necessary changes to make it compatible with new versions of Rails.

Hopefully, you take as much time considering the gems you are using as the time you spend deciding on the structure of your code.

For popular gems, upgrading generally isn’t a problem. While the new version of Rails is working its way through the beta testing stages, any compatibility issues will likely have been discovered and fixed by the time the final version is released. But for others, you should do a bit of an audit beforehand to verify that the gems that you rely on will indeed work with the new version of Rails.

It’s good practice to keep dependencies up-to-date, even between major Rails versions, to ensure that you’re receiving the benefits of bug fixes, security fixes, and not getting too far behind on upgrades.

Running bundler outdated will give you a list of the gems that have new versions. Updating and testing each one (thoroughly) will greatly ease your migration path to a new Rails version.

That said, if you’re waiting for the release of a gem that’s not maintained, this should similarly raise alarm bells and you should start looking toward a solution. This is technical debt raising its ugly head and you’re better off getting on top of it quickly.

But, my Application’s Working Fine - do I Really Have to Upgrade?

If there is no compelling case to move to Rails 6 now, we highly recommend you immediately upgrade to Rails 5.2. You won’t get the latest new features, but that will keep you on the upgrade path regarding bug and security fixes for a while, as per the current Rails maintenance policy (see below). Just bear in mind that as time marches on, Rails 5.2 will drop out of the versions supported by the Rails team; first for bug fixes, then for general security issues, then for severe security issues.

The Scary bit. It Really is Important you Upgrade.

Any app running a version of Rails lower than 5.1 or 5.2 will no longer receive general security patches. Older versions may receive updates for “severe” security issues, but not for much longer, and what is classified as “severe” is at the discretion of the Rails team.

Any app running a version of Rails less than 5.2 will no longer receive any bug fixes, meaning that any bug fixes will be up to you and your team to tackle.

At the end of the day, if you let your Ruby or Rails versions lapse, you’re introducing technical debt, which, if not addressed, can make it difficult to add new functionality to your app or in extreme cases necessitate a full re-write of your codebase (ouch!)

A Last Note: Don’t Forget to Upgrade Ruby.

Depending on how long since you have upgraded, you may need to upgrade your Ruby version, as Rails 6.0 requires at least Ruby 2.5.0.

Generally this is a simple task, but you do want to ensure you thoroughly test any changes you make. As mentioned above, you will likely run into issues with the gems that you rely on needing upgrading at this point, too, as many gems require a minimum version of Ruby.

Upgrading Ruby is also going to see performance improvements for your application. So again, it’s well worth it.

Need Help?

If you need help upgrading, we’re more than happy to give you a quote on the work needed and are generally willing to offer discounts for upgrades in certain conditions. Good luck upgrading!