2025/01/21分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Deprecate using
insert_all
/upsert_all
with unpersisted records in associations. ActiveRecord::Coder::JSON
can be instantiated
Deprecate using insert_all/upsert_all with unpersisted records in associations.
activerecord/lib/active_record/associations/collection_proxy.rb
保存していないassociationのrecord経由でのinsert_all
/upsert_all
をdeprecatedにしています。Reset AR::Relation in bulk insert and upsert methodsの対応の影響で、保存していないassociationは失われてしまうようになっていたのですが、失われないことを期待している既存の処理がある可能性がある為、一旦保存していないassociationの挙動は前のバージョンと同じになるようにし、今後消えるようになる旨メッセージを出力するようにしています。
Will not cause insert_all
to error [ci-skip]
activerecord/CHANGELOG.md
の出力です。
先の対応のCHANGELOGのエントリーで、該当の処理はエラーになる旨記載されいたのを削除しています。insert_all
はエラーにならない為。
Update has_one
example to use descending order [ci skip]
activerecord/lib/active_record/associations.rb
のdocの修正です。
has_one
メソッドのdoc内のexampleコードで、associationにorder
を指定する場合のexampleにdesc
を指定するよう修正しています。association名がlast_comment
となっており、最後のデータをとれるようにする為。
Use already-loaded relation contents in #sole
activerecord/lib/active_record/relation/finder_methods.rb
の修正です。
Use limit in #sole, not first.の対応の影響で、#sole
メソッドがload済みのrelationがある場合にも必ずqueryが実行されるようになっていたのを、load済みのassociationがある場合はそちらが使用されるよう修正しています。
Merge pull request #54172 from matthaigh27/main
Active Record、Active Supportの修正です。
JSON.parse
で使用するオプションをActiveRecord::Coder::JSON
に指定出来るよう対応、及び、ActiveRecord::Coder::JSON
のインスタンスをserialize
メソッドの:coder
オプションに渡せるよう修正しています。
serialize :config, coder: ActiveRecord::Coder::JSON.new(symbolize_names: true)
合わせて、ActiveSupport::JSON.decode
にJSON.parse
で使用するオプションを指定出来るよう修正しています。
AS::MessageVerifier#verify always accept both safe and unsafe encoding
activesupport/lib/active_support/message_verifier.rb
の修正です。
ActiveSupport::MessageVerifier#verify
にURL-safe/URL-unsafeどちらのencoded messagesも指定出来るよう修正しています。Rails 7.2からencoding処理がBase64 encodingからURL-safe Base64 encodingに変わった影響で、元々問題無かったURL-ensafeなmessagesがdecodeでエラーになるようになってしまっていました。そのため、アップグレードをスムーズに行えるようにする為、verify
についてはURL-unsafeな値についても元と同様に処理を行えるよう修正しています。
Prefer assert_dom over assert_select.
docの修正です。
assert_select
を使用している箇所をassert_dom
を使用するよう修正、及び、assert_selector
を使うべき箇所ではassert_selector
に修正しています。assert_dom
は現在assert_select
のaliasなのですが、Capybaraにassert_selector
メソッドがある影響で混乱する事が多い為、assert_dom
を使用するよう修正しています。
Improve test_json_symbolize_names_returns_symbolized_names
activerecord/test/cases/serialized_attribute_test.rb
の修正です。
assert_equal
に指定する値をexpected, actualの順になるよう修正しています。
Fix serialize coder: JSON, type: Hash
to wrap the coder in ColumnSerializer
activerecord/lib/active_record/attribute_methods/serialization.rb
の修正です。
先のserialize
処理の修正の影響で、serialize :my_hash, type: Hash, coder: JSON
のように指定した場合のデフォルトの挙動が変わってしまっていたのを修正しています。