Blog

How to Update your Rails Application to the Latest Version (7.0.1)

Carol Mascarenhas
January 24, 2022

Working on an outdated software project can be a frustrating experience.

Developers on an outdated project cannot use the facilities and new resources that accompany the evolution of languages and frameworks.

Managers of the project are subject to less frequent and more complicated deliveries due to limitations in that outdated environment.

In this context, the most critical impact is to the end-users of your web application. They may suffer from bad system performance, security issues and vulnerabilities that can cause data loss and other problems.

Best practices guide us that the update process needs to be part of your software development routine. Ideally, your other development activities will share comparable priority with code updates day by day. This routine consists of frequently performing minor code updates, deprecation warning fixes and applying the security patches when available. In other words, it’s excellent if you can keep down the technical debt related to software updates in your day-to-day activities.

We observe in the real world that new features and bug fixes frequently have a higher priority over maintenance activities. It’s because the development teams usually focus on supporting the business requirements of the organisation.

We provide CodeCare and OpsCare to support companies that don’t have the in-house resources to carry out these maintenance activities. These two services include strategies to handle Security Patches and Version Updates.

This article will discuss how to update your rails application to the latest version. After you complete the read, you will know the current stable version available and recognise your current version. These two pieces of information together will help you plan your update process.

Also, if you are not clear whether you need a version update right now, I bring highlights to support your decision toward it.

Finally, I will conclude the content with a step by step on how to update your rails app and how reinteractive can keep you on this way if you need further help.

What is the Latest Version of Rails? Rails 7.0

On 6 January 2022, the Rails community released version 7.0.1. At the time of writing, this is the latest stable version of Ruby on Rails. You can find more information at this link [here (https://rubyonrails.org/).

Also, check out the video demo that explains the impressive new capabilities of Rails version 7.

What version of Rails are you currently using?

Before starting your update plan, it’s super important to identify the current version of your web application and the steps you will need to upgrade to the latest stable version of Ruby on Rails. You can find the complete list of Rails versions and their release dates at this link.

The current version of your codebase is at your Gemfile. Search for a line similar to this: gem 'rails', '~> 6.0.4', '>= 6.0.4.2'

You also can verify it using a command line. So go to the root repository of your application and run: rails --version

Do you need to upgrade Rails?

Now you know where you are and all the intermediate steps to achieve the latest version. So you can start thinking about why you need to update to the latest? How urgent is this update?

As the newest versions are released, the old ones are at risk. Do you know how long your application has been at risk?

Only the latest version series receive bug fixes. The current one receiving bugfixes is 7.0.Z. Further, only the two latest series receive security patches. Also, for severe security issues, only specific major series have support.

The classification of these severe security issues is up to the team core. So take a look at the table below.

Version Released Security Support Release
7.0 15 Dec 2021 Yes 7.0.1
6.1 9 Dec 2020 Yes 6.1.4.4
6.0 16 Aug 2019 Ends 01 Jun 2023 6.0.4.4
5.2 09 Apr 2018 Ends 01 Jun 2022 5.2.6
5.1 27 Apr 2017 Ended 25 Aug 2019 5.1.7
5.0 30 Jun 2016 Ended 09 Apr 2018 5.0.7.2
4.2 20 Dec 2014 Ended 27 Apr 2017 4.2.11.1

Can you see your current version?

The maintenance policy for Ruby on Rails outlines the versions that receive updates and which are no longer supported. Check out the policy to see how urgent your upgrade process is.

Updating your Rails

Now you have a plan to update your application, let’s see the step-by-step to achieve your goal. Before starting the journey toward the latest version, ensure you have good test coverage of your codebase. It’s not mandatory, but it will help you feel confident that your application will still be working correctly at the end of the upgrade process. In other words, you will receive early feedback from the automated tests about how the version update impacts your implemented features.

Step 1:

At your Gemfile, replace the current version with the aiming version. Then run the command below at your root code repository: bundle update

Step 2

Run the update task using the command: rails app:update This task will start an interactive session creating new files and changing old ones. So follow the instructions on the screen. This step combines your configuration files with the latest version.

Step 3

Fix the deprecated features related to your target version. Check out the upgrading Ruby on Rails guide here to see what you will need to change at this step. My advice is to move slowly, change by change, always run your test suite or start the application server to verify that everything is working as before. You may need to repeat these three steps many times until you get to the latest version.

Ruby on Rails DevOps as an Alternative

The upgrading Rails process is as long and complex as the size and complexity of your application. The work will be related to keeping your project’s gems and the framework resources you use working after the changes. If there are many versions to go through before achieving the latest version, It will take time and lots of patience. Don’t worry, and do not be overwhelmed.

Our team has performed many upgrades, and we know the challenges related to it. The task is achievable. If your team does not have the hands to deal with this upgrade right now, please consider our upgrade service as an alternative.

Key Takeaways

There are many benefits you will have to be at the latest version. It’s worth it. Your development team will use all the new resources and facilities the latest versions will bring.

You also can easily find new developers to work in an up-to-date environment. The development managers can notice a speedup of deliveries as the project will have less technical debt.

Finally, remember that your end-users will experience a more performant, better optimised and more secure application.

The upgrade process seems an excellent investment to allow these great reasons.