AetherEchoesEngineering
Vol.042026年4月21日
Engineering#00022 min1736 view

Rails 6.1 から 8.1 への移行メモ

Rails 6.1 の API-only 構成を 8.1 に引き上げる際に気をつけたポイントを、load_defaults や Spring 廃止など実例で整理します。

SoSoraEndo2026年4月21日2 min173

概要

AetherEchoes のバージョンアップで Rails 6.1.7 を Rails 8.1.3 に引き上げました。API-only 構成でも load_defaults や Spring 周りで手当てが必要だったので手順を共有します。

主な変更点

1. load_defaults を 8.1 へ

# config/application.rb
config.load_defaults 8.1

2. cache_classesenable_reloading

# development.rb
config.enable_reloading = true

3. Spring の廃止

Rails 7 以降、標準添付されなくなりました。bin/rails から load File.expand_path("spring", __dir__) を削除し、bin/springconfig/spring.rb を消します。

4. show_exceptions がシンボルへ

# test.rb
config.action_dispatch.show_exceptions = :none

5. :unprocessable_entity:unprocessable_content

Rack のステータスシンボル名が変更されました。render status: と RSpec の have_http_status の両方を置換します。

まとめ

API-only プロジェクトでも config の小さな書き換えは複数発生します。段階的に適用して RSpec を都度走らせるのが確実です。

Tags

Reaction

Share

X (Twitter)