The official guide to upgrading the Rails version is available here.
In general, there are four steps to follow:
1) Upgrade the rails version to the next available minor version.
2) Check the major impacts and change points in the upgrade guide.
3) Check the config\initializers\new_framework_defaults_x.rb file
4) Run application test
Finally, repeat the steps 1-4 above until you have successfully upgraded to the target version.
Example of upgrading from Rails 7.2 to 8.0
1. Upgrading the Rails version
1) In the Gemfile, edit the Rails gem version.
# gem 'rails', '~> 7.2.1'
gem 'rails', '~> 8.0'
2) Update the gem and run the upgrade task.
$ bundle update rails
$ rails app:update
3) In this process, file conflicts are prevalent. You should carefully merge what is necessary.
2. Check major changes
1) I already used the solid queue gem. Migration is unnecessary.
2) However, there is a new asset pipeline library - Propshaft.
3) The upgrade guide is available here. Not all steps are necessary, and it depends on your current setup. If you are not using "webpacker" (or similar) and "sass" most likely the steps are straightforward.
4) There is a change which is not mentioned in the documentation.
# layout/application.html.erb
# Old
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
# New
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
4) I decided not to install Kamal Gem since I am not doing a containerized deployment.
3. Turn on necessary defaults
1) In config\initializers\new_framework_defaults_8_0.rb, check and turn on new default values.
Rails.application.config.active_support.to_time_preserves_timezone = :zone
Rails.application.config.action_dispatch.strict_freshness = true
Regexp.timeout = 1
4. Test
Finally, run your application testing.