Skip to content

upgrade from rails 8.0.0 to 8.1.2 #1578

@tyranja

Description

@tyranja

Upgrading from Rails 8.0.0 to 8.1.2 involves updating the Gemfile to gem "rails", "~> 8.1.2",
running bundle update rails, and executing bin/rails app:update to apply configuration changes.

The upgrade is generally smooth, but requires updating package.json for JS dependencies, checking SQLite3 string modes, and addressing new association deprecations.

Step-by-Step
Upgrade GuidePrepare for the Upgrade:Ensure your application has high test coverage and all tests pass on 8.0.0.

Commit all changes and create a new git branch: git checkout -b upgrade-to-rails-8-1-2.

Update the Gemfile:Change the Rails version:rubygem "rails", "~> 8.1.2"

Run bundle update rails.

Run the Update Task:Run bin/rails app:update

to interactively update configuration files, initializers, and locale files.

Note: Pay attention to config/environments/*.rb changes, especially around secret_key_base and new caching formats.

Update JavaScript Dependencies:If using jsbundling-rails, run bin/rails javascript:install or update your package.json to align with the new Rails JS package versions.

Review Changes and Test:
Run your test suite (bin/rails test).Check for deprecation warnings, especially regarding new association deprecations (e.g., has_many :through behavior changes).

If using SQLite3, note that SQLite3Adapter now defaults to strict strings mode.

Key Changes in Rails 8.1+Performance: Default Puma threads changed from 5 to 3 to improve latency.
Logging: Rails.logger now uses ActiveSupport::BroadcastLogger.
Database: schema.rb might show changed ordering of columns (alphabetized).
Active Job: Improvements in continuations, requiring idempotent jobs.

Deprecations: Address any association warnings, as they will become errors in later versions.If you are using gems that hook into ActiveRecord (like Devise), ensure they are updated to compatible versions to avoid issues with new 8.1 features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions