なるようになるブログ

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

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

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

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


Fix small typo in docs

activesupport/lib/active_support/message_encryptor.rbactivesupport/lib/active_support/message_verifier.rbのdocの修正です。

uptoup toに修正しています。


AbstractController::Translation#t: dup options

actionpack/lib/abstract_controller/translation.rbの修正です。

AbstractController::Translation#translateメソッドの先頭で引数のoptionsdupするよう修正しています。メソッド内でoptionsの値を変更しており、元の値に影響を与えないようにする為。


Merge pull request #35262 from gmcgibbon/reword_ar_rdbms_note

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

Object Relational Mappingの項にあるRDBMSに関する説明の箇所の言い回しを修正しています。


Implement AS::Dependencies.verbose= compatibility for :zeitwerk mode

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

autoloaderにzeitwerkを使用している場合に、ActiveSupport::Dependencies.verbose=の指定が無視されてしまっていたのを、ActiveSupport::Dependencies.verbose=に指定された値に合わせてログを出力するよう修正しています。


Allow to pass options to csp_meta_tag

actionview/lib/action_view/helpers/csp_helper.rbの修正です。

csp_meta_tagメソッドに任意のオプションを指定出来るよう修正しています。name以外のattribtue(e.g. property)を指定出来るようにするため。


Show deprecated message instead of raise exception in compiled_method_container method

actionview/lib/action_view/base.rbの修正です。

ActionView::Base#compiled_method_containerメソッドで、メソッドが独自に定義されていない場合にNotImplementedErrorをraiseしていたのを、deprecateメッセージを出すよう修正しています。

Move compiled ERB to an AV::Base subclass以降、ActionView::Baseの子クラスではcompiled_method_containerメソッドを定義するのが必須になっていたのですが、それだとbreaking changeになってしまう為、(挙動としてはちょっと怪しいが)エラーにはならないよう修正しています。


Merge pull request #35286 from matthewdunbar/master

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rbの修正です。

cached queriesを処理する際にbind paramsが制限値以上の場合に、prepared statementを使用しないよう修正しています。

Fallback to unprepared statement only when bind params limit is exceededで行った対応と同じ内容をcached queriesの場合も行うようにしています。


Add changelog entry for #35212

activerecord/CHANGELOG.mdの修正です。

sqlite3 adapterにadd_foreign_key / remove_foreign_keyメソッドを追加した、SQLite3: Implement add_foreign_key and remove_foreign_keyの対応についてCHANGELOGにエントリーを追加しています。


Refactor remove_foreign_key to delete the foreign key before alter_table

activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rbの修正です。

remove_foreign_keyメソッドでalter_tableを行うより先にforeign keyの削除処理を行うようリファクタリングしています。


Remove NoForeignKeySupportTest which is no longer reached

activerecord/test/cases/migration/foreign_key_test.rbactiverecord/test/cases/migration/references_foreign_key_test.rbの修正です。

NoForeignKeySupportTestを削除しています。現状、全てのadapterでforeign keyをサポートしており、処理が実行されない為。


Fix possible memory leak of ConnectionHandler

activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rbの修正です。

ConnectionHandler#initializeメソッド内のblockで行っていたpoolの作成処理をクラスメソッド(create_owner_to_pool)に切り出しています。

ここで作成したpoolはObjectSpace.#define_finalizerを使用してobj解放時にdiscardされるようになっています(実際の処理はunowned_pool_finalizerメソッド)。元の実装だと間接的にhandlerの参照が残っている状態(finalizer proc -> @owner_to_pool -> initializerという流れ)になってしまっており、結果handlerがGCされない、という問題がありました。

それを避ける為(参照が残らないようにする為)にクラスメソッドにするよう修正しています。

参考: