2021/11/25分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Add missing comment char to RDoc comment
activerecord/lib/active_record/relation/calculations.rb
のdocの修正です。
count
メソッドのdoc内のexampleコードのコメント部分の先頭に#
が不足していたのを修正しています。
Allow a fallback value to be returned from Rails.error.handle
activesupport/lib/active_support/error_reporter.rb
の修正です。
Rails.error.handle
にerrorになった場合に返すfallback値を指定出来るよう修正しています。
user = Rails.error.handle(fallback: User.anonymous) do User.find_by(params) end
Merge pull request #43712 from Shopify/as-cache-error-handling
Active Supportの修正です。
Memcache storeとRedis storeのerror report処理でActiveSupport::ErrorReporter
を使用するよう修正しています。
Merge pull request #43711 from Shopify/thread-accessor-isolated-state
activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
の修正です。
thread_mattr_accessor
で、Introduce ActiveSupport::IsolatedExecutionState for internal useで追加したActiveSupport::IsolatedExecutionState
を使用するよう修正しています。
Merge pull request #43704 from esparta/fix_race_conditions_test_cache_iv
activesupport/test/cache/behaviors/failure_raising_behavior.rb
、
activesupport/test/cache/behaviors/failure_safety_behavior.rb
の修正です。
Active Supportのcacheのテストで、異なるテストで同じkeyを使っていたのを、keyにランダムな値を使用するようにして、並列に実行してもfailしないよう修正しています。
Add support for passing the list of columns to update in upsert_all
activerecord/lib/active_record/insert_all.rb
、
activerecord/lib/active_record/persistence.rb
の修正です。
upsert_all
に、コンフリした場合に更新するカラムを指定する為の:update_only
オプションを追加しています。
Commodity.upsert_all( [ { id: 2, name: "Copper", price: 4.84 }, { id: 4, name: "Gold", price: 1380.87 }, { id: 6, name: "Aluminium", price: 0.35 } ], update_only: [:price] # `price`カラムのみ更新される )
Use ActiveRecord::FixtureSet.signed_global_id
defined by the globalid gem
activerecord/lib/active_record/fixtures.rb
の修正です。
Active Recordで定義されていたsigned_global_id
を、globalid gemで定義されているsigned_global_id
を使用するようする修正しています。
元々signed_global_id
はActive Record側で定義されていたメソッドなのですが、このメソッドはglobalidに依存している、かつ、Active Recordはglobalidには依存しておらず、globalidを前提としたコードをActive Record側で定義するのはよくないよね、という事でglobalid側で定義されるようになりました。
Add missing space to error message
activerecord/lib/active_record/encryption/scheme.rb
の修正です。
credentialの設定が正しく行われていない場合のエラーメッセージにスペースが不足していたのを修正しています。
Explicitly order Railties by load order
railties/lib/rails/railtie.rb
の修正です。
Class#descendants
を使用する事によって、Railtiesのload順がランダムになってしまっていたのを、元と同じように指定した順にロードされるよう修正しています。load順がランダムになると挙動が変わってしまうケースがある為。
AS::Callbacks specialize call templates for better performance
activesupport/lib/active_support/callbacks.rb
の修正です。
run_callbacks
にcallbackが登録されていない場合の性能改善の為のリファクタリングを行っています。