なるようになるブログ

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

rails commit log流し読み(2024/07/20)

2024/07/20分のコミットです。

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

activesupport/CHANGELOG.md


Merge pull request #52359 from fatkodima/fix-find_or_initialize_by-for-cpk-associations

activerecord/lib/active_record/relation/predicate_builder/association_query_value.rbの修正です。

composite primary keysを使用しているassociationに対するfind_or_initialize_byのfind処理が正しく行われないバグがあったのを修正しています。


Merge pull request #52366 from Shopify/require-hotloop

activesupport/lib/active_support/configuration_file.rbの修正です。

ConfigurationFile#readメソッド内のyamlerbのrequire処理を、それぞれ必要な時のみ(gemがloadされてない場合のみ)実行するよう修正しています。

Ruby 3.3でコード中のrequireがRuby 3.2までと比べて大変遅くなっているようで、テスト等でConfigurationFile#readが実行された際の性能の改善の為修正を行っています。

参考:Bug #20641: `lib/bundled_gems.rb` makes `Kernel.require` over 100x slower


Merge pull request #52347 from jhawthorn/time_change_workaround

activesupport/lib/active_support/core_ext/time/calculations.rbの修正です。

幾つかのRubyに、Time zoneオブジェクトを指定したTimeオブジェクトが誤ったutc offsetを返してしまう、というバグがあり、そのバグの為のworkaroundを追加しています。このバグはRuby 3.3.1及び3.2.4で修正済みです。

参考:Bug #20327: Time.new behaves differently when passing a zone as timezone object


Merge pull request #52370 from jhawthorn/time_addition_deprecation

activesupport/lib/active_support/core_ext/time/calculations.rbactivesupport/lib/active_support/time_with_zone.rbの修正です。

Time及びActiveSupport::TimeWithZone#since及び#+に対して、Time及びActiveSupport::TimeWithZoneインスタンスを指定した場合(e.g. Time.now.since(Time.now)10.days.ago + 10.days.ago)の挙動をdeprecatedにしています。現在、これらを実行しても正しい結果を得られない状態で、挙動としてサポートする必要も無いだろう、という事でdeprecateにしています。