なるようになるブログ

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

rails commit log流し読み(2015/10/09)

2015/10/09分のコミットです。

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

activerecord/CHANGELOG.md


Follow DRY principle and remove duplication

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

url_forメソッドで、引数のoptionsHashActionController::Parametesの場合とで、処理が重複していたので、重複していた処理をメソッドに切り出しています。


Avoid leaking the first relation we call #first on

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

Relation#firstで取得したオブジェクトがGCの対象にならないバグがあったのを修正しています。

-        define_singleton_method(name) do |*a, &b|
-          instance.public_send(name, *a, &b)
-        end
+        #
+        # By letting #delegate handle it, we avoid an enclosure that'll capture args.
+        singleton_class.delegate name, to: :instance

define_singleton_methodメソッドのブロック内で値を設定してしまっていた為、enclosure内に値がキャプチャされてしまった為、GC対象にならなかった、という事のような…。多分…。


Merge pull request #21912 from y-yagi/move_prepare_destination_to_public

railties/lib/rails/generators/testing/behaviour.rbのdocの修正です。

prepare_destinationメソッドを、privte APIからpublic APIに変更しています。

prepare_destinationメソッドはgeneratorsのデフォルトのテンプレートファイルで使用されており、API docで見れる状態が正しいと思った為。