なるようになるブログ

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

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

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

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


[ci skip] Updated migration version to 6.0 in the getting started docs

rails guideのGetting Started with Railsの修正です。

migrationファイルのバージョンを5.0 -> 6.0に修正しています。

基本的にはguideのmigrationファイルのバージョン更新のPRは受け付けてないのですが、今回はGetting Started guideでの修正なのでマージしたとの事です。


Pass lookup context to the layout handlers

actionview/lib/action_view/layouts.rbactionview/lib/action_view/renderer/template_renderer.rbの修正です。

layout handlersのメソッドの引数にlookup_contextを追加しています。

lookup_contextの呼び出し回数を減らす為の対応を行っており、その一環との事です。


update callbacks skipping methods in guide [ci skip]

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

Skipping Callbacksの項にあるcallbackをskipするメソッドの一覧に誤りがあったのを修正しています。


Ensure that rendered templates always have a format

Action Viewの修正です。

元々formatを保持していなかったRenderedCollection::EmptyCollection classでもformatを保持するよう修正しています。

これにより、rendered templateが必ずformatを保持する状態になり、処理の分岐を削除 + lookup_contextの呼び出しを減らせるようになっています。


Skip test_select_with_subquery_in_from_uses_original_table_name on CI

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

Skip test_select_with_subquery_in_from_uses_original_table_name on Buildkite as wellでBuildkite上でもtest_select_with_subquery_in_from_uses_original_table_nameが実行されないようにする為に、ENV["BUILDKITE"]がある場合はテストをskipするようにしたのですが、それが期待通りに動作しなかった為、ENV["CI"]を見るよう修正しています。


Make test_select_with_subquery_in_from_uses_original_table_name work with old SQLite3

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

test_select_with_subquery_in_from_uses_original_table_nameがCIで通らなかったのは、古いSQLiteではsubquery flatteningにより正しいカラム名が取得出来ない、という問題があった為のようでした。

という訳で、subqueryにDISTINCTを追加してsubquery flatteningが行われないようにして対応しています。

参考:The SQLite Query Optimizer Overview


Merge pull request #35374 from rails/cache-inline-templates

Action Viewの修正です。

developmentで、inline templatesのrener処理でメモリリークが発生してしまっていたのを修正しています。

通常のテンプレートと異なりinline templateはcompile後の状態でのキャッシュが行えず、処理を行う度に正しく解放されないオブジェクトが生成されてしまっていました。で、これを避ける為に、inline templateについてはfinalizerを定義しrender時に使用したメソッドを削除し、オブジェクトの解放が正しく行われるよう修正しています。


Upgrade Zeitwerk to 1.3.1

activesupport/activesupport.gemspecの修正です。

Zeitwerk gemのバージョンを1.3.1に更新しています。