Upgrade Rails from 6.0 to 6.1

Upgrade Rails from 6.0 to 6.1

This article is part of our Upgrade Rails series. To see more of them, click here.

This article will cover the most important aspects that you need to know to get your Ruby on Rails application from version 6.0 to 6.1.

  1. Preparations
  2. Ruby version
  3. Gems
  4. Config files
  5. Rails Guides
  6. Removals
  7. 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. Find out more about how and why to dual boot.
  • To learn more about dual booting with non-backwards compatible changes you can visit this article.

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

2. Ruby version

Rails 6.1 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.1. In case you are the maintainer of the gem, you’ll need to make sure it supports Rails 6.1 and if it doesn’t, update it. A great site to checkout compatibility is RailsBump.

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 6.0.x and 6.1.x (or any other source/target versions).

5. Rails Guides

It is important to check through the official Rails Guides and follow any of the steps necessary for your application.

6. Removals

If you have ignored deprecation warnings on past version jumps, and haven’t been staying up to date with them you may find that you have issues with broken tests or broken parts of the application. If you have trouble figuring out why something is broken it may be because a deprecation is removed, so you can check through this list to see if this may be the case.

Action Pack
Action View
Action Mailer
Active Record
  • Remove deprecated methods from ActiveRecord::ConnectionAdapters::DatabaseLimits. column_name_length table_name_length columns_per_table indexes_per_table columns_per_multicolumn_index sql_query_length joins_per_query

  • Remove deprecated ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_multi_insert?.

  • Remove deprecated ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_foreign_keys_in_create?.

  • Remove deprecated ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#supports_ranges?.

  • Remove deprecated ActiveRecord::Base#update_attributes and ActiveRecord::Base#update_attributes!.

  • Remove deprecated migrations_path argument in ActiveRecord::ConnectionAdapter::SchemaStatements.

  • Remove deprecated config.active_record.sqlite3.represent_boolean_as_integer.

  • Remove deprecated methods from ActiveRecord::DatabaseConfigurations.

  • Remove deprecated ActiveRecord::Result#to_hash method.

  • Remove deprecated support for using unsafe raw SQL in ActiveRecord::Relation methods.

Active Storage
Active Support
  • Remove deprecated fallback to I18n.default_local when config.i18n.fallbacks is empty.

  • Remove deprecated LoggerSilence constant.

  • Remove deprecated ActiveSupport::LoggerThreadSafeLevel#after_initialize.

  • Remove deprecated Module#parent_name, Module#parent and Module#parents.

  • Remove deprecated file active_support/core_ext/module/reachable.

  • Remove deprecated file active_support/core_ext/numeric/inquiry.

  • Remove deprecated file active_support/core_ext/array/prepend_and_append.

  • Remove deprecated file active_support/core_ext/hash/compact.

  • Remove deprecated file active_support/core_ext/hash/transform_values.

  • Remove deprecated file active_support/core_ext/range/include_range.

  • Remove deprecated ActiveSupport::Multibyte::Chars#consumes? and ActiveSupport::Multibyte::Chars#normalize.

  • Remove deprecatedActiveSupport::Multibyte::Unicode.pack_graphemes, ActiveSupport::Multibyte::Unicode.unpack_graphemes, ActiveSupport::Multibyte::Unicode.normalize, ActiveSupport::Multibyte::Unicode.downcase, ActiveSupport::Multibyte::Unicode.upcase and ActiveSupport::Multibyte::Unicode.swapcase.

  • Remove deprecatedActiveSupport::Notifications::Instrumenter#end=.

7. Next steps

If you successfully followed all of these steps, you should now be running Rails 6.1! Do you have any other useful tips or recommendations? Did we miss anything important? Share them with us in the comments section.

If you’re not on Rails 6.1 yet, we can help! Download our free eBook: The Complete Guide to Upgrade Rails.

Get the book