This article will cover the most important aspects that you need to know to get your
Ruby on Rails application from
version 5.2 to
6.0.
- Preparations
- Ruby version
- Gems
- Config files
- Removals
- Webpacker
- Credentials
- Next steps
1. PREPARATIONS
Before beginning with the upgrade process, we have some recommended preparations:
- Your Rails app should have the latest patch version before you move to the next major/minor version.
- You should have at least 80% test coverage unless you have a dedicated QA team.
- Follow a Git flow workflow to actively manage at least two environments: staging and production.
- Check your Gemfile.lock for incompatibilities by using RailsBump.
- Create a dual boot mechanism, the fastest way to do this is installing the handy gem next_rails.
2. RUBY VERSION
3. GEMS
Make sure you check the Github page of the gems you use for the project to find out its compatibility with Rails 6.0. In case you own the gem, you'll need to make sure it supports Rails 6.0 and if it doesn't, update it.
4. CONFIG FILES
Rails includes the rails app:update
task. You can use this task as a guideline as explained thoroughly in
this post.
As an alternative, check out
RailsDiff, which provides an overview of the changes in a basic Rails app between 5.2.x and 6.0.x (or any other source/target versions).
5. REMOVALS
RAILTIES
ACTION PACK
- Remove deprecated fragment_cache_key helper in favor of combined_fragment_cache_key.
- Remove deprecated methods in ActionDispatch::TestResponse: #success? in favor of #successful?, #missing? in favor of #not_found?, #error? in favor of #server_error?
ACTION VIEW
- Remove deprecated image_alt helper.
- Remove an empty RecordTagHelper module from which the functionality was already moved to the record_tag_helper gem.
ACTIVE RECORD
6. WEBPACKER
Webpacker is
now the default JavaScript compiler for Rails 6. You can still manage your JavaScript using the
Asset Pipeline but it might be a good idea to start migrating to Webpack.