なるようになるブログ

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

rails commit log流し読み(2019/02/20)

2019/02/20分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #35271 from gmcgibbon/fix_time_attribute_test_failures

activerecord/test/cases/attribute_methods_test.rbの修正です。

YAML dumpingのテストの後処理でreset_column_informationを呼び出すよう修正しています。

テストの中でtableの情報を変更していまっているものがあり、その影響でテストがコケてしまう場合がある為。


Merge pull request #35293 from rails/remove-rendered-format-from-cache

Action Viewの修正です。

digestorに、template formatを明示的に渡せるよう修正しています。

元々はActionView::LookupContextrendered_formatを使用するようになっていたのですが、それを使用出来るようにする為に、digest生成処理の途中でActionView::LookupContextrendered_formatに値を設定するようになっていました。

このような処理の途中での状態の変化を避けれるようにする為に、そもそも引数で明示的にformatを渡せるようにしています。


Merge pull request #35265 from rails/return-rendered-templates

Action Viewの修正です。

renderersがrenderしたtemplate objectsを返すよう修正しています。

元々はStringを返すようになってい。renderしたtemplate自体の情報は返さないようになっていました。そのため、controllerが実際にrenderしたtemplateを知る為に、lookup contextのrendered_formatを使用していました。ただ、そのためにlookup contextの状態を変化させてしまうのは良いやり方ではない為、controllerがlookup contextの変異に依存せずrenderしたtemplateの情報を知れるようにする為に、戻り値をtemplate objectにするよう修正しています。


Merge pull request #35332 from rails/zeitwerk-unhook

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

autoloaderにzeitwerkを使用している場合に、ActiveSupport::Dependenciesのunhook処理を事前に呼び出しておくよう修正しています。

backtraceに不要なファイル(dependencies.rb)が含まれないようにする為。


Merge pull request #35331 from rails/depreate-rendered-format

actionview/lib/action_view/lookup_context.rbactionview/lib/action_view/rendering.rbの修正です。

諸々のリファクタリングによりActionView::LookupContext#rendered_formatが不要になったので、メソッドをdeprecateにしています。


Add delegation tests for delete_by and destroy_by methods

activerecord/test/cases/relation/delegation_test.rbの修正です。

Relationにdelegateするメソッドについてのテストで、テスト対象のメソッドにdelete_bydestroy_byを追加しています。


Fix reset of the source association when through association is loaded

activerecord/lib/active_record/associations/preloader/association.rbactiverecord/lib/active_record/associations/preloader/through_association.rbの修正です。

through associationがcustom scopeを持っている、かつ、そのscopeがsource associationに適用される内容だった場合に、scopeが正しく適応されないバグがあったのを修正しています。


PostgreSQL: Support endless range values for range types

activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rbactiverecord/lib/active_record/connection_adapters/postgresql/quoting.rbの修正です。

PostgreSQLのrange typesでRuby 2.6から入ったendless rangeを使用出来るよう修正しています。


Merge pull request #35327 from abhaynikam/use-delete-by-and-destroy-by-method

Active Recordの修正です。

where + delete_all / destroy_allを使用していた箇所を、delete_by / destroy_byを使用するよう修正しています。


[ci skip] Updated the documentation for bulk delete in activerecord

rails guideのActive Record Basicsの修正です。

bulk deleteについて説明している箇所に、destroy_byメソッドについての説明を追加しています。