なるようになるブログ

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

rails commit log流し読み(2019/09/06)

2019/09/06分のコミットです。

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

activestorage/CHANGELOG.md


Optimize Module#delegate to no longer be linear

activesupport/lib/active_support/core_ext/module/delegation.rbの修正です。

Module#delegateメソッドでdelegate処理をする毎にmodule_evalを実行していたのを、極力module_evalの呼び出しを行わずにすむようリファクタリングしています。


Merge pull request #37139 from Shopify/define-url-helper-patch

actionpack/lib/action_dispatch/routing/route_set.rbの修正です。

UrlHelper.optimize_helper?でrouteのglob?より先にroute.path.requirements.empty?のチェックを行うよう修正しています。

(routingの内容によりますが)glob?は遅くなる事が多く、empty?チェックを先にする事で性能改善する事がある為。


Implement content disposition in direct upload

Active Storageの修正です。

クラウドサービスにdirect uploadを行う際に、ヘッダーにcontent dispositionを含むよう修正しています。


Fix comments to update mysql version in reference URL [ci skip]

activerecord/lib/arel/visitors/mysql.rbactiverecord/test/cases/arel/visitors/mysql_test.rbのdocの修正です。

MySQLのdocへのリンクのバージョンを5.0(https://dev.mysql.com/doc/refman/5.0/en)から8.0(https://dev.mysql.com/doc/refman/8.0/en)に更新しています。


Bump Capybara require version

railties/lib/rails/generators/rails/app/templates/Gemfile.ttの修正です。

rails newで生成されるGemfile内のCapybaraのバージョン指定を>= 3.26に修正しています。Stop setting a default Capybara app hostでCapybara 3.26以上がsysem testで必要になっている為。


Unify AR touch method signatures

Active Recordの修正です。

touchメソッドの引数定義を全てのクラス / モジュールで同じになるよう修正しています。


Revert "send with **options only when options is not empty"

RequestHelpersのメソッドを呼びだす際にoptionsが空でない場合にのみoptionsを指定するよう修正した、send with **options only when options is not emptyをRevertしています。

Ruby側で修正が入り空の場合でもエラーにならなくなった為。が、Ruby 2.5、2.6では動作しない(エラーになる)為、後ほどRevertされています。


AR save takes keyword arguments

activerecord/lib/active_record/suppressor.rbの修正です。

saveメソッドでキーワード引数を受け取れるようメソッド定義を修正しています。


Passing in a Hash instance as kwargs parameters requires the "double splat" prefix

activerecord/lib/active_record/railties/collection_cache_association_loading.rbの修正です。

Hashをキーワード引数として渡す箇所にdouble splatの指定を追加しています。


Include kwargs definition in the generated method signatures and method calls

activemodel/lib/active_model/attribute_methods.rbの修正です。

attribute methodsでキーワード引数を受け取れるよう修正しています。が、これによりテストがコケるようになってしまった為、後ほどRevertされています。


Keyword arguments is not a Hash

activestorage/lib/active_storage/service/disk_service.rbの修正です。

キーワード引数を渡す際にHashとして渡していたのを、Hashではなくそのままキーワード引数として渡すよう修正しています。


Revert "Revert "send with **options only when options is not empty""

Revert "send with **options only when options is not empty"を再度Revertしています。


Refactor define_url_helper to share the same instance between path and url

actionpack/lib/action_dispatch/routing/route_set.rbの修正です。

path helperとurl helperを定義するのにそれぞれ事なるUrlHelperインスタンスを使用していたのを、同じインスタンスを使い回すようリファクタリングしています。


Revert "Include kwargs definition in the generated method signatures and method calls"

attribute methodsでキーワード引数を受け取れるよう修正した、Include kwargs definition in the generated method signatures and method callsをRevertしています。