なるようになるブログ

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

rails commit log流し読み(2024/05/13)

2024/05/13分のコミットです。

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

activerecord/CHANGELOG.md


Support touch_all in batches

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

batches系のAPI経由でtouch_allを使用出来るよう修正しています。

Post.in_batches.touch_all

Refactor ActiveRecord::SignedId to not rely on relation delegation

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

ActiveRecord::SignedId moduleの処理をrelation delegationに依存しないようリファクタリングしています。元々はActiveRecord::Relationのmissing methodsをmodel classに自動でdelegateする処理に依存していたのですが、この処理に依存するのはバグになりやすいため、Rails内部の処理はそこに依存しないで済むように対応していく、とのことです。


Do not trigger devcontainer tests on pull requests

.github/workflows/devcontainer-smoke-test.ymlの修正です。

devcontainerのテストをPRでは実行しないよう修正しています。PRを実行する前にコードの確認をする必要があるため。


Refactor ActiveRecord::TokenFor to not rely on relation delegation

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

ActiveRecord::TokenFor moduleの処理をrelation delegationに依存しないようリファクタリングしています。先のActiveRecord::SignedId moduleの対応と同様の理由。


Fix: batch test assertion order

activerecord/test/cases/batches_test.rbの修正です。

assert_equalメソッドの引数が逆(actual、expectedの順になっていた)になっていたのを修正しています。


Enable Lint/Debugger

Lint/Debugger lintを有効化するよう修正しています。


Merge pull request #51805 from Shopify/refactor-ar-peristence-relation-methods

Active Recordの修正です。

ActiveRecord::Persistenceのclass methodをRelationのmethodに移動しています。

ActiveRecord::Relationのmissing methodsをmodel classに自動でdelegateする処理に依存するのを減らす対応の一環。


Suppress RuboCop output when there are no offenses in code generation

railties/lib/rails/configuration.rbの修正です。

generatorで生成されたファイルに対してRuboCopのautocorrectを自動で行う際に、--format=quietオプションを指定してconsoleへの出力が行われないよう修正しています。


Use foreign_key option for destroy_async test models

activerecord/test/models/cpk/book_destroy_async.rbactiverecord/test/models/cpk/chapter_destroy_async.rbの修正です。

deprecatedになったassociationのquery_constraintsオプションを使用している箇所があったのを修正しています。