Upgrade Rails from 7.2 to 8.0
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 7.2 to version 8.0 .
- 1. Preparations
- 2. Ruby Version
- 3. Gems
- 4. Config Files
- 5. Rails Guides
- 6. Notable New Features
- 7. Application Code
- 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. We do have an article for strategies on upgrading with low test coverage as well.
- Have a staging environment that is as similar as possible to production, so that proper QA can be completed.
- 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 refer to our Solving Dual Booting Issues when Changes aren’t Backwards Compatible article.
For full details check out our article on How to Prepare Your App for a Rails Upgrade .
2. Ruby Version
For the Rails 8.0 release, Ruby 3.2 is the required minimum version.
Check out our Ruby & Rails Compatibility Table to see all the required Ruby versions across all Rails versions.
3. Gems
Make sure you check the GitHub page of the gems currently installed in your application for more information about compatibility with Rails 8.0. If you are the maintainer of the gem, you’ll need to make sure it supports Rails 8.0.
A great tool to checkout gems compatibility is RailsBump .
We also encourage you to use the next-rails
gem to run bundle_report outdated
for more information on gems that will require an update. Check out our article on The Next Rails Gem to learn more.
4. Config Files
Rails includes the rails app:update
task .
You can use this task as a guideline as explained thoroughly by this Revisiting rails:update blog post.
As an alternative, check out RailsDiff , which provides an overview of the changes in a basic Rails app between 7.2.x and 8.0.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. Notable New Features
Built-In Authentication: Rails now provides a default authentication generator. This simplifies setting up essential features, such as database-backed sessions and password resets, without relying on external gems.
7. Application Code
If you have ignored deprecation warnings on past version jumps, and haven’t stayed 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. The following is a list of the removals in Rails 8.0.
7.1 Railties
- Remove deprecated
config.read_encrypted_secrets
. - Remove deprecated file
rails/console/app
. - Remove deprecated file
rails/console/helpers
. - Remove deprecated support to extend Rails console through
Rails::ConsoleMethods
. - See full list of changes in the changelog .
7.2 Action Pack
- Remove
Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality
. - See full list of changes in the changelog .
7.3 Action View
- Remove deprecated support to passing
nil
to themodel:
argument ofform_with
. - Remove deprecated support to passing a content to void tag elements on the
tag
builder. - See full list of changes in the changelog .
7.4 Active Record
- Remove deprecated
config.active_record.commit_transaction_on_non_local_return
. - Remove deprecated
config.active_record.allow_deprecated_singular_associations_name
. - Remove deprecated support to finding database adapters that aren’t registered to Active Record.
- Remove deprecated support for defining
enum
with keyword arguments. - Remove deprecated
config.active_record.warn_on_records_fetched_greater_than
. - Remove deprecated
config.active_record.sqlite3_deprecated_warning
. - Remove deprecated
ActiveRecord::ConnectionAdapters::ConnectionPool#connection
. - Remove deprecated support to passing a database name to
cache_dump_filename
. - Remove deprecated support to setting
ENV["SCHEMA_CACHE"]
. - See full list of changes in the changelog .
7.5 Active Support
- Remove deprecated
ActiveSupport::ProxyObject
. - Remove deprecated support to setting
attr_internal_naming_format
with a@
prefix. - Remove deprecated support to passing an array of strings to
ActiveSupport::Deprecation#warn
. - See full list of changes in the changelog .
7.6 Active Job
- Remove deprecated
config.active_job.use_big_decimal_serializer
. - See full list of changes in the changelog .
8. Next Steps
If you successfully followed all of these steps, you should now be running Rails 8.0!
If you find yourself in need of assistance or your team doesn’t have the time to tackle these challenges, you can always contact us. Our experts are here to help you navigate the upgrade process and ensure your Rails application continues to thrive.
Download our free eBook: The Complete Guide to Upgrade Rails .