Tech Racho エンジニアの「?」を「!」に。
  • Ruby / Rails関連

Rails 8.1.0.rc1がリリースされました(全項目リンク付き)

Ruby on Rails 8.1.0.rc1がリリースされました。

英語版Changelogをまとめて見るにはGItHubのリリースタグ↓が便利です。v8.1.0.rc1タグの日付は日本時間の2025/10/15 09:50でした。

詳しくは以下のコミットリストをご覧ください。

なお、従来8.1.0マイルストーンにあった多数のissueは、8.2.0マイルストーンに移動されました。

🔗 Active Support

🔗 Remove deprecated passing a Time object to Time#since · rails/rails@a855714

#52370で非推奨化されていた、Time#sinceにTimeオブジェクトを渡せる機能を削除。
Rafael Mendonça França
同Changelogより

🔗 Remove deprecated Benchmark.ms method. It is now defined in the `be… · rails/rails@632b2c5

#62746で非推奨化されていたBenchmark.msメソッドを削除。同メソッドは現在benchmark gemに定義されている。

Rafael Mendonça França
同Changelogより

ruby/benchmark - GitHub

🔗 Remove deprecated addition for Time instances with `ActiveSupport::… · rails/rails@93d370c

#52370で非推奨化されていた、ActiveSupport::TimeWithZoneTimeインスタンスを渡せるサポートを削除。

Rafael Mendonça França
同Changelogより

🔗 Remove deprecated support for to_time to preserve the system local … · rails/rails@c79dc28

#52091で非推奨化された、to_timeでシステムローカル時間を保持する振る舞いが削除された。今後は常にレシーバーのタイムゾーンを保持するようになった。

同時にconfig.active_support.to_time_preserves_timezoneが非推奨化された。

Rafael Mendonça França
同Changelogより

🔗 Standardize event name formatting in assert_event_reported by george-ma · Pull Request #55859 · rails/rails

assert_event_reportedエラーメッセージのイベント名のフォーマットを標準化した。

今後、失敗したときのメッセージでは.inspectが使われるようになる(例: name: "user.created")。これにより、assert_events_reportedでマッチするようになり、文字列とシンボルの区別が明確になる。
この変更で影響を受けるのは、失敗したときのメッセージ自体のアサーションを行うテストのみ。

George Ma
同Changelogより

🔗 Fix Enumerable#sole when element is a tuple by olivier-thatch · Pull Request #55808 · rails/rails

Enumerable#soleがタプルの最初の要素だけを返していたのを、完全なタプルを返すよう修正。

Olivier Bellone
同Changelogより

🔗 [Fix #55513] parallel tests hanging when worker processes die abruptly by joshuay03 · Pull Request #55794 · rails/rails

ワーカープロセスを急停止したときにパラレルテストがハングする問題を修正。

従来は、パラレルテストの実行中にワーカーが(メモリ不足やkill -9などで)killされると、死んだワーカーをテストスイートがずっと待ち続けてしまうことがあった。

Joshua Young
同Changelogより

🔗 Stop escaping JS separators in JSON by default by etiennebarrie · Pull Request #55800 · rails/rails

config.active_support.escape_js_separators_in_json設定を追加。

JSONに含まれるLINE SEPARATOR(U+2028)とPARAGRAPH SEPARATOR(U+2029)のエスケープをデフォルトでスキップする新しいデフォルト設定がフレームワークに導入された。

歴史的には、これらの文字はJavaScriptのリテラル文字列内では無効とされていたが、ECMAScript 2019で変更された。このため、現代のブラウザでは問題ではなくなった。

参考: JavaScript built-in: JSON: JavaScript is a superset of JSON | Can I use... Support tables for HTML5, CSS3, etc

Étienne BarriéJean Boussier
同Changelogより

🔗 [Fix #55776] class_attribute on instance singleton class raises NameError by joshuay03 · Pull Request #55786 · rails/rails

インスタンスのシングルトンクラスでclass_attributeを定義するとNameErrorになる問題を修正。

修正前は、インスタンスのシングルトンクラスでclass_attributeを呼び出すと、そのインスタンスを介して属性にアクセスしたときにNameErrorがraiseされた。

object = MyClass.new
object.singleton_class.class_attribute :foo, default: "bar"
object.foo # 従来は"bar"を返さずにNameErrorになった

Joshua Young
同Changelogより

🔗 Introduce with_debug_event_reporting to enable event reporter debug mode by gmcgibbon · Pull Request #55748 · rails/rails

ActiveSupport::Testing::EventReporterAssertionsに、テスト中にイベントレポーターのデバッグモードを入稿にする#with_debug_event_reportingが導入された。

従来はイベントレポーター自身で#with_debugメソッドを使うことでデバッグモードを有効にしていたが、これは冗長で混乱の元となっていた。新しいヘルパーによって、イベントのデバッグをテストする方法が明確になった。

Gannon McGibbon
同Changelogより

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

ActiveSupport::StructuredEventSubscriberが追加された。
これは通知を受け取って、構造化されたイベントログを出力する。イベントは#emit_event#emit_debug_eventで出力できる。

class MyStructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber
  def notification(event)
    emit_event("my.notification", data: 1)
  end
end

Adrianna Chang
同Changelogより

🔗 [Fix #55708] Use process time instead of Time.now in FileUpdateChecker by grodowski · Pull Request #55710 · rails/rails

ActiveSupport::FileUpdateCheckerTime.nowに依存しなくなった。
これにより、タイムトラベル用のテストヘルパーで不要な再読み込みが防止される。

Jan Grodowski
同Changelogより

Rails: Timecopを使わなくても時間を止められた話

🔗 Active Model

🔗 Make reset token expiry configurable in has_secure_password by jevin · Pull Request #55574 · rails/rails

has_secure_passwordreset_token: { expires_in: ... }オプションが追加された。

これにより、パスワードリセットトークンの有効期間を設定可能になった(後方互換性のため、デフォルトは15分のまま変わらず)。

has_secure_password reset_token: { expires_in: 1.hour }

Jevin SewAbeid Ahmed

同Changelogより

参考: §2.2.1 has_secure_password -- Rails セキュリティガイド - Railsガイド

🔗 Active Record

🔗 Add replicas to test database parallelization setup by a-maas · Pull Request #55769 · rails/rails

テストデータベースのパラレル化でreplicaデータベースをセットアップするよう修正。

これにより、パラレル実行される統合テストで「replicaデータベース」「データベースセレクタミドルウェア」「非トランザクションテスト」を使うときに、番号付きパラレルワーカーのデータベース(db_test_{n})ではなく、基本となるテストデータベース(db_test)が選択されるようになる。

Adam Maas
同Changelogより

🔗 Support virtual (not persisted) generated columns on PostgreSQL 18+ by yahonda · Pull Request #55142 · rails/rails

PostgreSQL 18以降で、仮想(つまり永続化しない)生成カラムをサポート。

PostgreSQL 18で、永続化されない仮想生成カラムがサポートされた。この機能は、PostgreSQL 18以降で明示的にstored: trueオプションを指定して永続化しない限り、デフォルトになる。

create_table :users do |t|
  t.string :name
  t.virtual :lower_name,  type: :string,  as: "LOWER(name)", stored: false
  t.virtual :name_length, type: :integer, as: "LENGTH(name)"
end

Yasuo Honda
同Changelogより

参考: PostgreSQL 17.5文書 -- 5.4. 生成列

🔗 Dedupe schema dumps and refactor test helpers by mikeygough · Pull Request #55713 · rails/rails

スキーマダンプで生成されるファイルの重複を防ぐよう修正。

ActiveRecord::Tasks::DatabaseTasks.dump_allは、どのスキーマファイルが既にダンプ済みかをトラッキングして、同じファイルのダンプを行わないようになった。これにより、同一のスキーマダンプパスを共有するマルチプルデータベース設定のパフォーマンスが改善される。

Mikey GoughHartley McGuire
同Changelogより

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Active Recordに以下の構造化イベントを追加。

  • active_record.strict_loading_violation
  • active_record.sql

Gannon McGibbon
同Changelogより

Active Supportに追加された構造化イベント機能(#55748)を利用しています。

🔗 Support integer shard keys by HeyNonster · Pull Request #55680 · rails/rails

整数値のシャードキーをサポートするようになった。

# シンボルをシャードキーとして渡せるようになった
ActiveRecord::Base.connects_to(shards: {
  1: { writing: :primary_shard_one, reading: :primary_shard_one },
  2: { writing: :primary_shard_two, reading: :primary_shard_two},
})

ActiveRecord::Base.connected_to(shard: 1) do
  # ..
end

Nony Dutton
同Changelogより

🔗 Add only_columns to activerecord by Glyde02 · Pull Request #55121 · rails/rails

ActiveRecord::Base.only_columnsを追加。

ignored_columnsとユースケースが似ているが、無視するカラムではなく「残したい」カラムを指定する点が異なる。

データベースのレガシーなスキーマや共有されているスキーマを扱う場合や、スキーマ変更を3回のデプロイではなく2回のデプロイで安全に行うときに有用。

Anton Kandratski
同Changelogより

Rails: Active Recordモデルのカラムを安全に削除する(翻訳)

🔗 Use PG::Connection#close_prepared when available by skipkayhil · Pull Request #55683 · rails/rails

可能な場合は、PG::Connection#close_prepared(プロトコルレベルでのclose)を用いてプリペアドステートメントのアロケーションを解除するようになった。

この機能を利用するには、pg gemが1.6.0以上、libpq gemが17以上、PostgreSQLデータベースが17以上でなければならない。

Hartley McGuireAndrew Jackson
同Changelogより

🔗 Fix query cache for pinned connections in multi threaded transactional tests by byroot · Pull Request #55703 · rails/rails

複数スレッドによるトランザクションテストでデータベースコネクションがスレッドにピン留めされている場合にクエリキャッシュが期待通りに割り当てられない問題を修正。

修正後は、1個のコネクションが複数スレッドに渡ってピン留めされている場合にスレッドごとに個別のキャッシュストアが使われるようになった。

これにより、システムテストや、マルチスレッドを用いるテストの精度が向上する。

Heinrich Lee YuJean Boussier
同Changelogより

🔗 Fix time attribute dirty tracking with timezone conversions by prateekkish · Pull Request #55298 · rails/rails

時刻の属性のダーティトラッキングにおけるタイムゾーン変換を修正。

日付を含まず時刻のみを含む属性は、今後タイムゾーン変換時に日付を2000-01-01に固定するようになる。これによって、日付がずれたときにその属性が誤って「変更済み」とマーキングされるのを防止する。

このプルリクによって、時刻の属性の時刻値が変更されていない場合にタイムゾーン変換によって内部の日付がずれると、時刻の属性が誤って「変更済み」とマーキングされる問題が修正される。

Prateek Choudhary
同Changelogより

🔗 Skip calling PG::Connection#cancel when using libpq >= 18 with pg < 1.6.0 by yahonda · Pull Request #55540 · rails/rails

libpq gemのバージョンが18以上でpg gemのバージョンが1.6.0未満の場合は、互換性の問題を防ぐためにcancel_any_running_queryPG::Connection#cancelの呼び出しをスキップするよう修正。
ロールバックは引き続き実行されるが、時間がかかる可能性がある。

Yasuo HondaLars Kanis
同Changelogより

🔗 Don't add id_value attribute alias when id_value is present by kohder · Pull Request #55691 · rails/rails

id_value属性・カラムのエイリアスが既に存在している場合はエイリアスを追加しないよう修正。

Rob Lewis
同Changelogより

🔗 Action View

🔗 Place template annotation on a separate line by siaw23 · Pull Request #53731 · rails/rails

テンプレートのBEGINアノテーション・コメントは、従来は次の要素と同じ行に出力されていた。

これを改善して、改行をコメント内に挿入することで、HTML出力に目に見える空白を追加せずにコメントを2行に渡って表示するようにし、読みやすさを向上させた。

改修前:

<!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb --><p>This is grand!</p>

改修後:

<!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb
    --><p>This is grand!</p>

Emmanuel Hayford
同Changelogより

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Action Viewに以下の構造化イベントを追加。

  • action_view.render_template
  • action_view.render_partial
  • action_view.render_layout
  • action_view.render_collection
  • action_view.render_start

Gannon McGibbon
同Changelogより

🔗 Fix label for attribute missing form namespace by skipkayhil · Pull Request #55719 · rails/rails

ラベルのfor属性にフォームのnamespace値がプレフィックスされなかった問題を修正。

Abeid AhmedHartley McGuire
同Changelogより

Rails 5.1〜8.0: 'form_with' APIドキュメント(翻訳)

🔗 Add fetchpriority to Link headers to match the generated HTML by prel… · rails/rails@c22750a

Linkヘッダーにfetchpriorityを追加するよう修正。これにより、preload_link_tagで生成されるHTMLと一致するようになった。

Guillermo Iguaran
同Changelogより

参考: §5.7 preload_link_tag -- Action View ヘルパー - Railsガイド

🔗 Action Pack

🔗 Add link-local IP ranges to RemoteIp default proxies by adam12 · Pull Request #55821 · rails/rails

リンクローカルなIPアドレス範囲を、ActionDispatch::RemoteIpのデフォルトのプロキシに追加。

プライベートIPアドレス範囲と同様に、リンクローカルなIPアドレス(IPv4は169.254.0.0/16、IPv6はfe80::/10)もデフォルトの信頼済みプロキシに追加された(RFC 3849に準拠)。

Adam Daniels
同Changelogより

参考: RFC 3849 - IPv6 Address Prefix Reserved for Documentation 日本語訳

🔗 Don’t ignore X-Forwarded-For IPs with ports attached (again) by ybiquitous · Pull Request #49894 · rails/rails

remote_ip3.4.5.6:1234のようにポート情報が指定されている場合に、X-Forwarded-Forヘッダー内のIPを無視しないよう修正。

Duncan BrownPrevenios MarinosMasafumi KobaAdam Daniels
同Changelogより

🔗 Add setting for logging redirect source locations by dennispaagman · Pull Request #52297 · rails/rails

action_dispatch.verbose_redirect_logs設定を追加。これはリダイレクトの呼び出し元をログ出力する。

active_record.verbose_query_logsactive_job.verbose_enqueue_logsと同様に、リダイレクトの呼び出し元を以下のようにログに追加する。

Redirected to http://localhost:3000/posts/1
↳ app/controllers/posts_controller.rb:32:in `block (2 levels) in create'

Dennis Paagman
同Changelogより

🔗 Make engine routes filterable in bin/rails routes, improve engine formatting by gmcgibbon · Pull Request #55752 · rails/rails

bin/rails routesコマンドにエンジンルーティングのフィルタ機能を追加し、フォーマットを改善。

ルーティングインスペクタでエンジンルーティングをフィルタ可能にし、エンジンのルーティング出力のフォーマットを改善。

改修前:

> bin/rails routes -e engine_only
No routes were found for this grep pattern.
For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.

改修後r:

> bin/rails routes -e engine_only
Routes for application:
No routes were found for this grep pattern.
For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.

Routes for Test::Engine:
Prefix Verb URI Pattern       Controller#Action
engine GET  /engine_only(.:format) a#b

Dennis PaagmanGannon McGibbon
同Changelogより

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Action PackとAction Dispatchに以下の構造化イベントを追加。

  • action_dispatch.redirect
  • action_controller.request_started
  • action_controller.request_completed
  • action_controller.callback_halted
  • action_controller.rescue_from_handled
  • action_controller.file_sent
  • action_controller.redirected
  • action_controller.data_sent
  • action_controller.unpermitted_parameters
  • action_controller.fragment_cache

Adrianna Chang
同Changelogより

🔗 Fix SCRIPT_NAME handling in URL helpers for root-mounted engines by flavorjones · Pull Request #55668 · rails/rails

アプリケーションのrootにマウントされたエンジンのURLヘルパーがSCRIPT_NAMEを正しく扱えるよう修正。

"/"にマウントされたエンジン内で生成されるルーティングのパスにSCRIPT_NAMEが適用されていなかった問題を修正。

Mike Dalessio
同Changelogより

🔗 RateLimiting: support method names for :by and :with by seanpdoyle · Pull Request #53146 · rails/rails

ActionController::Metal::RateLimitingを更新し、:by:withのどちらでもメソッド名を渡せるようになった。

class SignupsController < ApplicationController
  rate_limit to: 10, within: 1.minute, with: :redirect_with_flash

  private
    def redirect_with_flash
      redirect_to root_url, alert: "Too many requests!"
    end
end

Sean Doyle
同Changelogより

🔗 Optimise ActionDispatch::Http::URL.build_host_url when protocol in host by joshuay03 · Pull Request #55641 · rails/rails

hostにプロトコル名が含まれている場合のActionDispatch::Http::URL.build_host_urlを最適化。

URLヘルパーでhostにプロトコル名が含まれている場合(例: { host: "https://example.com" })、プロトコル名の不要な正規化や文字列の重複をスキップするようになった(抽出されたプロトコル名のフォーマットは既に正しいため)。これにより、URL生成ごとに文字列が2回アロケーションされていたのが排除され、このケースでは最大で10%パフォーマンスが改善する。

Joshua YoungHartley McGuire
同Changelogより

🔗 Allow disabling action_controller.logger by setting it to nil or false by robertomiranda · Pull Request #55625 · rails/rails

従来は常にデフォルトでRails.loggerが使われていたのを、action_controller.loggernilfalseを設定することで無効にできるようになった。

Roberto Miranda
同Changelogより

🔗 Active Job

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Active Jobに以下の構造化イベントを追加。

  • active_job.enqueued
  • active_job.bulk_enqueued
  • active_job.started
  • active_job.completed
  • active_job.retry_scheduled
  • active_job.retry_stopped
  • active_job.discarded
  • active_job.interrupt
  • active_job.resume
  • active_job.step_skipped
  • active_job.step_started
  • active_job.step

Adrianna Chang
同Changelogより

🔗 Action Mailer

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Action Mailerに以下の構造化イベントを追加。

  • action_mailer.delivered
  • action_mailer.processed

Gannon McGibbon
同Changelogより

🔗 Active Storage

🔗 Structured event subscribers by gmcgibbon · Pull Request #55690 · rails/rails

Active Storageに以下の構造化イベントを追加。

  • active_storage.service_upload
  • active_storage.service_download
  • active_storage.service_streaming_download
  • active_storage.preview
  • active_storage.service_delete
  • active_storage.service_delete_prefixed
  • active_storage.service_exist
  • active_storage.service_url
  • active_storage.service_mirror

Gannon McGibbon
同Changelogより

🔗 Restore Active Storage config to disable variants and analyzers by zzak · Pull Request #55303 · rails/rails

Active Storageのアナライザとバリアントトランスフォーマーを完全にコンフィグ可能になった。

# ActiveStorage.analyzersに空配列も設定可能になった
config.active_storage.analyzers = []
# => ActiveStorage.analyzers = []

# カスタムアナライザも指定可能
config.active_storage.analyzers = [ CustomAnalyzer ]
# => ActiveStorage.analyzers = [ CustomAnalyzer ]

設定が提供されない場合は、デフォルトのアナライザが使われる。

バリアントプロセッサも同様に無効にできるようになった。これにより、gemが存在しない状態で起動したときの警告が表示されなくなる。

config.active_storage.variant_processor = :disabled

zzakAlexandre Ruban
同Changelogより

🔗 Action Text

🔗 De-couple @rails/actiontext/attachment_upload.js from Trix.Attachment by seanpdoyle · Pull Request #55885 · rails/rails

Trix.Attachmentから@rails/actiontext/attachment_upload.jsを切り離した。

@rails/actiontext/index.jsdirect-upload:progressイベントリスナーとPromise解決を実装した。

Sean Doyle

同Changelogより

🔗 Action Text: change tag helpers to accept optional blocks by seanpdoyle · Pull Request #55827 · rails/rails

フォームヘルパーメソッドにブロックでコンテンツを渡せるようになった。

<%= rich_textarea_tag :content, nil do %>
  <h1>hello world</h1>
<% end %>
<!-- <input type="hidden" name="content" id="trix_input_1" value="<h1>hello world</h1>"/><trix-editor ... -->
<%= rich_textarea :message, :content, input: "trix_input_1" do %>
  <h1>hello world</h1>
<% end %>
<!-- <input type="hidden" name="message[content]" id="trix_input_1" value="<h1>hello world</h1>"/><trix-editor ... -->
<%= form_with model: Message.new do |form| %>
  <%= form.rich_textarea :content do %>
    <h1>hello world</h1>
  <% end %>
<% end %>
<!-- <form action="/messages" accept-charset="UTF-8" method="post"><input type="hidden" name="message[content]" id="message_content_trix_input_message" value="<h1>hello world</h1>"/><trix-editor ... -->

Sean Doyle
同Changelogより

Rails 5.1〜8.0: 'form_with' APIドキュメント(翻訳)

🔗 Generalize :rich_text_area Capybara selector by seanpdoyle · Pull Request #55666 · rails/rails

Capybaraの:rich_text_areaセレクタをTrix以外でも使えるよう汎用化。

:rich_text_areaが従来<trix-editor>に依存していたのを、[role="textbox"][contenteditable]に依存するよう変更。これにより、Trix以外にもより多くのAction Text対応WYSIWYGエディタを利用可能になる。

Sean Doyle
同Changelogより

🔗 Railties

🔗 Suggest bin/rails action_text:install from error page by seanpdoyle · Pull Request #50557 · rails/rails

Action Dispatchのエラーページにbin/rails action_text:installを実行するよう促すメッセージを追加。

Sean Doyle
同Changelogより

🔗 Remove deprecated STATS_DIRECTORIES · rails/rails@d4b2d78

##52226で非推奨化されていたSTATS_DIRECTORIESを削除。

Rafael Mendonça França
同Changelogより

🔗 Remove deprecated bin/rake stats command · rails/rails@cf7d5e4

#52231で非推奨化されていたbin/rake stats コマンドを削除。今後はbin/rail stats を使うこと。

Rafael Mendonça França

同Changelogより

🔗 Remove deprecated rails/console/methods.rb file · rails/rails@9fc9e11

#51760で非推奨化されていたrails/console/methods.rbファイルを削除。

Rafael Mendonça França
同Changelogより

🔗 Don't generate system tests by default by eileencodes · Pull Request #55743 · rails/rails

システムテストをデフォルトで生成しなくなった。

Railsのscaffoldジェネレータは、デフォルトではシステムテストを生成しなくなった。--system-tests=trueオプションを指定するか、bin/rails generate system_test name_of_testのようにコマンドを実行することでシステムテストを生成可能。

Eileen M. Uchitelle
同Changelogより

速報: Rails World 2025のDHHキーノートとRails 8.1beta1リリース

🔗 Optionally skip bundler-audit by that-jill · Pull Request #55714 · rails/rails

bundler-audit gemの追加をスキップ可能になった。

bin/rails app:updateの実行時にbundler-audit gemがインストールされていない場合は、bin/bundler-auditconfig/bundler-audit.ymlの追加をスキップするようになった。

新規Railsアプリ作成時--skip-bundler-auditオプションを追加することでもスキップ可能。--minimalジェネレータフラグを指定するときにも同じフラグが自動で追加される。

Jill Klang
同Changelogより

rubysec/bundler-audit - GitHub

🔗 Show engine routes in /rails/info/routes as well by p8 · Pull Request #55635 · rails/rails

ブラウザで/rails/info/routesを表示したときに、エンジンのルーティングも表示されるようになった。

Petrik de Heus
同Changelogより

🔗 fix: add conditional asset_path configuration for API apps to fix kamal deploy by saiqulhaq · Pull Request #55646 · rails/rails

APIアプリケーションで、Kamalのdeploy.yml設定ファイルにasset_pathを含めないよう修正。

APIアプリケーションはアセットを配信しないので、deploy.ymlファイルにasset_pathを設定する必要はなく、実行中のリクエストで404エラーを引き起こす可能性がある。asset_pathは、アセットを実際に配信する通常のRailsアプリでのみ追加されるようになる。

Saiqul Haq
同Changelogより

🔗 Revert "[Fix #53683] Reduce cache time for non-asset files in public dir" by byroot · Pull Request #55633 · rails/rails

デフォルトのconfig.public_file_server.headersコンフィグが誤っていたのを取り消した。

Rails 8.1.0.beta1で新規アプリケーションを作成していた場合は、必ずconfig/environments/production.rbを再生成するか、同ファイル内のconfig.public_file_server.headersコンフィグを以下のように修正しておくこと。

# すべてのアセットにダイジェストが付いているため、遠い将来の有効期限切れに備えてアセットをキャッシュする
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }

Jean Boussier
同Changelogより

🔗 Changelogに更新の記載がない機能

以下はChangelogには更新の記載がありません。

  • Action Cable
  • Action Mailbox
  • Guides

TechRachoではRubyやRailsの最新情報などの記事を平日に公開しています。TechRacho記事をいち早くお読みになりたい方はTwitterにて@techrachoのフォローをお願いします。また、タグやカテゴリごとにRSSフィードを購読することもできます)

関連記事

速報: Rails World 2025のDHHキーノートとRails 8.1beta1リリース

Rails 8.1.0.beta1のChangelog: Active Support(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Active Record(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Action View(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Active Job(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Action Pack(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Active Storage(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Railties(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Active Model、Action Mailer、Action Mailbox(全項目リンク付き)

Rails 8.1.0.beta1のChangelog: Action Cable、Action Text、ガイド(全項目リンク付き)


CONTACT

TechRachoでは、パートナーシップをご検討いただける方からの
ご連絡をお待ちしております。ぜひお気軽にご意見・ご相談ください。