Rails を 8.0 系にアップグレード#353
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Rails を 7.2.3.1 → 8.0.5 へアップグレードし、
config.load_defaultsも 7.1 → 8.0 に切替えて Rails 8.0 のフレームワークデフォルトを全面適用します。gem 'rails', '~> 8.0.0'で 8.0.x 系に固定(8.1 系は除外)。やったこと
gem アップグレード
~> 8.0.0に変更しbundle update railsで解決。コード修正なしで全テスト通過。変更は Gemfile / Gemfile.lock のみで、推移的依存(zeitwerk, rack, minitest, nokogiri 等)も更新。sassc-rails/rails-observers/activerecord-session_store/bootstrap-sassは無変更で Rails 8 互換。Ruby 3.4.9 / Bundler 2.6.9 は維持。8.0 デフォルトの段階適用
config/application.rbに明示記述し、各コミットで全テストを実行して安全を確認しながら導入。config.load_defaultsを 7.1 → 8.0 に切替えると同時に冗長化した明示設定を削除。belongs_to_required_by_default等のバージョンデフォルトに依らない既存オーバーライドはそのまま残す。適用された 8.0 デフォルト(7項目)
7.2 由来:
config.yjit = true(Ruby YJIT 有効化・性能向上)config.active_record.validate_migration_timestamps = true(マイグレーションのタイムスタンプ検証)config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]config.active_record.postgresql_adapter_decode_dates = true(PG の date 列をDateで返す)8.0 由来:
config.active_support.to_time_preserves_timezone = :zone(to_timeが完全な TZ を保持。Rails 8.1 の非推奨対応も兼ねる)config.action_dispatch.strict_freshness = true(条件付きGETで RFC 7232 に従い ETag を優先)Regexp.timeout = 1(ReDoS 対策のグローバル正規表現タイムアウト)動作確認
xit指定の意図的スキップで本変更とは無関係)to_time非推奨警告も解消