なるようになるブログ

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

rails commit log流し読み(2023/04/27)

2023/04/27分のコミットです。

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

activerecord/CHANGELOG.md


Remove noise from actionmailer callbacks test

actionmailer/test/callbacks_test.rbの修正です。

Action Mailerのcallbackのテストで不要なログがstdoutに出力されないよう修正しています。


Merge pull request #47659 from alpaca-tc/add_foreign_key_deferrable_must_be_false_or_symbol

Active Recordの修正です。

add_foreign_keyメソッドのdeferrable: trueオプションをdeprecateにしています。deferrableにtrueを指定した場合に:immediateとみなされる、という挙動がわかりづらい(deferrableには他にもSymbolの値が指定出来る)為。同様の挙動にしたい場合、今後はdeferrable: :immediateを指定する必要があります。


The deferrable foreign key can be passed to t.references.

activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rbの修正です。

t.referencesにdeferrable foreign keyを指定出来るよう修正しています。


Merge pull request #47987 from p8/guides/unlink-asset-pipeline-libs

rails guideのThe Asset Pipelineの修正です。

headingで外部ライブラリへのリンクを設定している箇所があったのを、headingではリンクせず、本文中にリンクを設定するよう修正しています。


Merge pull request #48071 from shivamsinghchahar/add-tests-for-aj-to-verify-queue-name-passed-as-symbols

activejob/test/cases/test_helper_test.rbの修正です。

test用のassertionメソッドでqueue nameにSymbolを指定出来る事を確認するテストを追加しています。


Add intersects? to Relation

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

ActiveRecord::Relationdelegateするメソッドの一覧にRuby 3.1で追加されたArray#intersect? を追加しています。


Merge pull request #47767 from joshuay03/fix-updated-at-not-updating-in-before-update

activerecord/lib/active_record/callbacks.rbactiverecord/lib/active_record/timestamp.rbの修正です。

before_update callbackでのみattributeが変更された場合に、updated_atが更新されないバグがあったのを修正しています。


Allow insert_all/upsert_all to use indexes with columns not in the same order as in :unique_by

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

insert_all/upsert_allunique_byに指定された値と、columnに実際に指定されているunique indexの値の順序が一致しない場合に、自動でcolumnに指定されている順序と合わせるよう修正しています。