Engineering

What’s coming in Rails 6?

The latest version of the Ruby on Rails framework, version 6, is being released at the end of April at RailsConf.

The Ruby on Rails framework is very mature and stable, making it a great option to develop on. It is heavily developed with a large developer user base. The new features will add to that while still providing cutting edge features that mean Rails continues to compete with the latest technologies.

From a support and maintenance perspective there are some standout features/improvements that we’re excited to see:

Requires Ruby 2.5+

It’s important to stay up to date with security and bug fixes through to improved performance. Rails has always balanced the need for stability while also continuing to innovate and add features to enable rapid development cycles. Using the newer versions of Ruby means Rails can take advantage of the new language features and its increased performance.

Testing improvements

Automated testing is an important aspect of any project to ensure that any regressions are caught before being released into the live environment and they are invaluable during upgrades so that there are no surprises.

The addition of parallel testing means that large test suites can run quicker by fully utilising all the cores of a CPU. Anything that can speed up the development cycle is a welcome addition while ensuring that bugs don’t accidentally get (re)introduced.

More complete testing for Action Cable is another welcome improvement which will provide more confidence in the correct functionality of features which utilise Action Cable for providing live page updates.

Technical improvements

Several big-ticket technical improvements will make developing using Rails even sweeter, and quicker.

Improved code loader

Firstly there’s Zeitwerk integration. This is an all-new code-loader which keeps the speed and ease of development benefits that we have long been used to but aims to eliminate the gotchas that can trip developers up. It promises to save developers from wasting valuable time debugging and tearing their hair trying to find the cause of odd issues. There should be fewer bald Rails developers going forward!

Better multiple database support

There have been gems that made this possible already, but now it’s built into Rails, it’ll mean it’s easier than ever to switch database connections. As an example, slow queries could target a read-only database replica to keep the load off the primary database maintaining performance for other users. It also enables developers to use a specialised database for specific operations efficiently.

Webpacker

Webpacker has been included in Rails since 5.1, but as of Rails 6, it will now be the default for working with javascript assets. Sprockets is still used for static assets and CSS compilation. It means that it’s easier than ever to include modern Javascript applications within your Rails codebase for ease of development and deployment.

Action Text

This new feature brings the Trix editor and rich text content to Rails applications. The Trix editor is a WYSIWYG editor like many others but since it implements its own document model it has complete control over what happens after every keystroke. It promises to make development of modern content editing much simpler, quicker and painless for developers because we will no longer have to find and handle all the browser inconsistencies that are so common. As with most Rails features, it’s integrated into the other frameworks, so images or other attachments are handled with Active Storage so scalability, etc. is handled by default.

Action Mailbox

Action Mailbox integrates incoming emails more directly into the application, providing a set of features to make handling and processing emails simple. It ships with a wide variety of methods to have incoming emails routed to the application and exposes a controller-like format to handle the incoming emails and process them. It includes data protection features out of the box so that emails which have been successfully processed are automatically incinerated after 30 days, so you’re not holding onto individuals private data unnecessarily.

What it also means

With the release of Rails 6.0, support for Rails 4.2 will end. If you haven’t upgraded to a more recent version and you want to stay protected from security vulnerabilities, then you need to update. If you don’t have the budget or capacity to tackle a Rails upgrade in the short term, then we highly recommend you consider a subscription to Rails LTS so that you can continue to benefit from security fixes.

Should you upgrade?

If you are concerned about security and the safety of your application then upgrading will almost certainly make sense. Beyond that, if your application isn’t expected to change much then the costs of an upgrade may not make financial sense in the short term. For these scenarios, it is worth considering using Rails LTS as a stop-gap measure.

We do not recommend staying on Rails LTS indefinitely, especially if you have ongoing development needs. You will find that development cycles will tend to lengthen as supported gems target newer versions of Rails, or bugs that affect your application are only fixed in versions that depend on later versions of Ruby on Rails.

Our typical advice for businesses who run critical Ruby on Rails applications without much development resource is to wait until the first point releases. There’s rarely a need to be on the bleeding edge so letting others find and fix the most egregious bugs is a sensible strategy.

However, you can prepare by testing the upgrade path and seeing what breaks to put a plan and a budget together.

Ready to upgrade?

Is your team too busy working on new features to have the time to upgrade, but you know it needs doing? We can work alongside your team to modernise your application, continually updating against their changes to leave them with a ready-made pull-request containing the update.

Or perhaps you have an application which is ageing and hasn’t been upgraded for some time? We are experts in maintaining Rails applications. Our proven process gathers together everything needed to handle your support and development needs, including updating Rails to keep your application secure and serving your business for years to come.

Don’t let your ageing Rails application hamstring your business, contact us today for a confidential discussion about securing your Ruby on Rails application for the future.