Monday, 23 May 2022
Logo
     
Home > Articles > Upgrade Rails from 5.2 to 6.0
article_img

Upgrade Rails from 5.2 to 6.0

rails ruby    over 1 year Ago     366   250   Like

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.

  1. Preparations
  2. Ruby version
  3. Gems
  4. Config files
  5. Removals
  6. Webpacker
  7. Credentials
  8. 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.

For full details check out our article on How to Prepare Your App for a Rails Upgrade.

2. RUBY VERSION

Rails 6.0 requires Ruby 2.5 or later. Check out this table to see all the required Ruby versions across all Rails versions.

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.

This Site is all about collection of best resources

Users able to write own articles or share the resources they know

If you found any copy right issues, kindly CONTACT US. will take Immediate Action.
Subscribe To Us

Busy At Work?? Not Having Time To Know Whats Happening In Ruby World??

We will Send You Weekly Notifications About News, Jobs, Articls, Conferences etc..

Subscribe Now