なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2026/05/23)

2026/05/23分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md

railties/CHANGELOG.md

actionmailbox/CHANGELOG.md


Allow create_join_table to accept a primary key

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbの修正です。

create_join_tableにprimary keyオプションを指定出来るよう修正しています。PostgreSQLのlogical replicationのように、すべてのテーブルでprimary keyが必要な場合にjoin tableにもprimary keyを作成出来るようにする為。

create_join_table :assemblies, :parts, primary_key: [:assembly_id, :part_id]

Merge pull request #56193 from shivabhusal/auto-color-scheme-svg

rails guideの修正です。

幾つかの画像についてdark mode用の画像を追加、 EPUBの場合は画像ファイルにpngファイルを使用しています。EPUBではsvgが正しく表示されない事がある為。


Fix incorrect SQL examples in ActiveRecord::QueryMethods docs [ci skip]

activerecord/lib/active_record/relation/query_methods.rbのdocの修正です。

ActiveRecord::QueryMethodsのdoc内のSQL exampleが、実際に生成されるSQLと異なる内容になっていたのを修正しています。


Improve insert_all error message to show key mismatch

activerecord/lib/active_record/insert_all.rbの修正です。

insert_all / upsert_allでkeyの指定誤りによりエラーになった場合に、エラーになったkeyの情報をエラーメッセージに含むよう修正しています。

Book.insert_all [{ name: "Rework", author_id: 1 }, { name: "Remote", author_id: 1, isbn: "x" }]
# ArgumentError: All objects being inserted must have the same keys (extra: [:isbn])

Fix grammar in ActiveRecord errors and integration doc comments [ci skip]

activerecord/lib/active_record/errors.rb、 activerecord/lib/active_record/integration.rbのdocの修正です。

doc内のグラマーの修正を行っています。


fix: validate subcommand in rails plugin command

railties/lib/rails/commands/plugin/plugin_command.rbの修正です。

rails pluginに不正なサブコマンドが指定された場合に、値を無視していたのをエラーをraiseするよう修正しています。


Fix #57401: Stop DRb service in Parallelization#shutdown to prevent lingering accept loop threads after workers exit and add a regression test.

activesupport/lib/active_support/testing/parallelization.rbの修正です。

parallel testの終了処理で、DRb serviceを停止するよう修正しています。accept用のスレッドが停まらずに残ってしまうのを避ける為。


Fix EpubTest to reset the current working directory after each test

guides/test/epub_test.rbの修正です。

テストの後処理でテストで作成したファイルが削除されるよう修正しています。


Merge pull request #57444 from Shopify/uk-frozen-lookup-context-default-procs

actionview/lib/action_view/lookup_context.rbの修正です。

LookupContext::Accessors::DEFAULT_PROCSをfreezeするよう修正しています。


Merge pull request #57437 from 55728/fix-doc-html-attr-quotes

Action Viewのdocの修正です。

doc内のHTMLの出力例のHTMLのattributeのエスケープ処理が、実際に生成されるコード同じ内容になるよう修正しています。


Include valid values in ActiveRecord::Enum invalid-value error

activerecord/lib/active_record/enum.rbの修正です。

enum attributeに不正な値を指定した場合のエラーメッセージに、指定出来る値の一覧を含むよう修正しています。

Book.new(status: "bogus")
# ArgumentError: 'bogus' is not a valid status. Valid values are: "proposed", "written", "published"

Merge pull request #57432 from yahonda/yahonda/pg-test-reset-connection

Active Recordのテストの修正です。

PostgreSQLテストの後処理で行うconnectionのリセット処理を、現在のconnectionのみリセットするよう修正しています。元々はpool全体をリセットするようになっていたのですが、それだと transactional fixturesを使用した場合に、 transactional fixturesのconnectionをcloseしない、という問題があった為。


Qualify association unscope values with table names

activerecord/lib/active_record/associations/association_scope.rb、 activerecord/lib/active_record/relation/query_methods.rbの修正です。

has_and_belongs_to_many associationで、関連するテーブル間に同名カラムが存在する場合に、unscopeので別テーブルのscopeが失われてしまうバグがあったのを修正しています。


Merge pull request #57450 from Shopify/uk-deep-freeze-number-converter-defaults

activesupport/lib/active_support/number_helper/number_converter.rbの修正です。

NumberConverter::DEFAULTS hashの、内側のhashもfreezeするよう修正しています。


Fix HTML-aware ERB compiler errors in bundled templates

各templateファイルから、不要な閉じタグの削除、不要なattributeの前のスペースの削除、などを行っています。Herb gemのパースでエラーにならないようにする為。


Handle malformed Mandrill events payloads in Action Mailbox

actionmailbox/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rbの修正です。

Mandrill用のinboud controllerで、payloadが不正な値の場合NoMethodErrorになり500が返しまっていたのを、MalformedEventsErrorをraise + 422を返すよう修正しています。


Don't mutate environment when loading test file

Action Mailboxのテストの修正です。テスト実行時にグローバルの値(MAILGUN_INGRESS_SIGNING_KEY、ActionMailbox.ingress)を変更してそのままになっている箇所があったのを、テスト終了後に元の値に戻すよう修正しています。


Fix #57334: Handle malformed SendGrid envelopes

actionmailbox/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rbの修正です。

Sendgrid用のinboud controllerで、envelopesが不正な値の場合NoMethodErrorになり500が返しまっていたのを、MalformedEventsErrorをraise + 422を返すよう修正しています。


Fix PostgreSQL COMMENT ON INDEX for schema-qualified tables

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb、 activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbの修正です。

add_indexにschema-qualified tableを指定+commentオプションを指定した場合に、commentを追加するSQLにschema-qualified tableが使われず、エラーになってしまうバグがあったのを修正しています。