2022/06/15分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Run transactional callbacks on the freshest instance to save a given record within a transaction.
- Enable strict strings mode for
SQLite3Adapter
Skip Active Storage and Action Mailer if Active Job is skipped
railties/lib/rails/app_updater.rb、
railties/lib/rails/generators/app_base.rbの修正です。
app:update実行時のframeworkが有効になっているかのチェック処理で、Active Jobがロードされていない場合、Active StorageとAction Mailerはロードしないよう修正しています。Active StorageはAction MailerはActive Jobに依存している為。
Run transactional callbacks on instances most likely to match DB state
Active Recordの修正です。
transactional内で同じレコードに対して変更処理を複数回実行した場合に、callbackには最初に更新した場合のインスタンスが渡っていたのを、最新の状態のインスタンスを渡すよう修正しています。
Product.transaction do Product.find(id).update!(title: "T-Shirt") Product.find(id).update!(description: "A cool T-shirt") end
上記のような場合に、元々は最初に更新した状態のインスタンス(descriptionが古い値のままのインスタンス)がcallbackに渡されていたのが、descriptionが最新の状態になったインスタンスが渡されるようになります。
実行されるcallbackにより渡されインスタンスには幾つか例外があります。詳細はドキュメント参照。
既存のアプリケーションは古い挙動のままで、load_defaultsに7.1以上を指定、または、config.active_record.run_commit_callbacks_on_first_saved_instances_in_transactionにfalseを指定した場合に新しい挙動になるようになっています。
activerecord/lib/active_record/relation/query_methods.rbのdocの修正です。
whereメソッドのdoc内のchain処理について説明している箇所に、associated、missingメソッドとchainする場合の例を追加しています。
Enable strict strings mode for SQLite3Adapter
Active Recordの修正です。
SQLite3 のstrict strings modeをconfigで有効化出来るよう修正しています。既存のアプリケーションは無効化されたままで、load_defaultsに7.1以上を指定、または、config.active_record.sqlite3_adapter_strict_strings_by_defaultにtrueを指定した場合に有効化されるようになっています。
Merge pull request #45359 from p8/guides/update-command-line-db-option
rails guideのThe Rails Command Lineの修正です。rails newにdatabaseオプションを指定した場合の挙動の説明を修正しています。