2024/10/07分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activemodel/CHANGELOG.md
- Add
:except_on
option for validations. Grants the ability to skip validations in specified contexts.
- Fix association scopes applying on the incorrect join when using a polymorphic
has_many through:
. - Allow to save records with polymorphic join tables that have inverse of specified.
Add except_on option for validations
activemodel/lib/active_model/validations.rb
、
activemodel/lib/active_model/validations/validates.rb
の修正です。
特定のcontextの場合にvalidationsをskip出来るようにする為の:except_on
オプションを追加しています。:except_on
オプションが指定された場合、そのcontextでのみvalidationがskipするようになっています。
class User < ApplicationRecord validates :birthday, presence: { except_on: :admin } end user = User.new user.save(context: :admin) # `birthday`に関するvalidationが実行されない
Fix multiple test leaks and inconsistencies in railties tests
railtiesの修正です。
railtitesのテスト実行にグローバルの情報(e.g. Rails::Generators.namespace
、Rails.app_class
)がテスト内で更新されてそのままになっていたのを、テストの後処理で元の値に戻すよう修正しています。
Update zeitwerk to silence mutex_m
deprecation warnings
Gemfile.lock
の修正です。
zeitwerk
gemを最新バージョンに更新しています。mutex_m
に関するdeprecateメッセージが表示されないようにする為。
Fix test leak due to using class instance variables and inheritance
railties/test/configuration/dynamic_options_test.rb
の修正です。
テスト内でRails::Railtie::Configuration
の@@options
の値を書き換えていたのを、テストの後処理で元の値に戻すよう修正しています。
Merge pull request #51507 from joshuay03/fix-polymorphic-has-many-through-with-association-scope
activerecord/lib/active_record/reflection.rb
の修正です。
has_many through associationにscopeを指定している、かつ、associationがpolymorphicの場合に、scopeが誤ったjoinに対してapplyされてしまうバグがあったのを修正しています。
Fix "Test is missing assertions" in middleware_stack_proxy_test.rb
railties/test/configuration/middleware_stack_proxy_test.rb
の修正です。
middleware_stack_proxy_test.rb
のテストでTest is missing assertions
のwarningが出ていたのを、assertionのcountを明示的にincrementしてwarningが出力されないよう修正しています。
Merge pull request #53176 from Stellenticket/polymorphic_inverse_of_chain
activerecord/lib/active_record/associations/has_many_through_association.rb
の修正です。
has_many through associationにscope、かつ、associationがpolymorphic、かつ、 inverse_of
が指定されている場合に、そのassocaitionに対するsaveがエラーになってしまうバグがあったのを修正しています。
Fix changelog typo from #51464
actionpack/CHANGELOG.md
の修正です。
[Fix #51463] Raise an error when invalid :only or :except options are given to #resource or #resourcesの対応のエントリーでオプション名をタイポしていたのを修正しています。
rails guideのError Reporting in Rails Applications
の修正です。
Reporting and Swallowing Errors
セクション内にあるRails.error.handle
のfallback
オプションを指定した場合のexampleコードで、メソッド名をタイポしている箇所があったのを修正しています。