なるようになるブログ

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

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

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

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


Update regular expression for checking valid MIME type

actionpack/lib/action_dispatch/http/mime_type.rbの修正です。

Raise exception when building invalid mime typeで行われたmime typeのチェック処理で、パラメータが指定されていた場合の考慮(e.g. text/html; parameter")が不足していたのを修正しています。


Instrument middleware processing

actionpack/lib/action_dispatch/middleware/stack.rbの修正です。

middleware生成時に使用する為のinstrument event(process_middleware.action_dispatch)を追加しています。payloadにはmiddlewareのクラス名が含まれるようになっています。


Merge pull request #35660 from kamipo/sanitize_as_sql_comment

Active Recordの修正です。

sanitize_as_sql_commentメソッドをSQL visitorからconnectionに移動しています。他の箇所でも使用出来るようにする為。


Merge pull request #35662 from jhawthorn/fallback_resolver_no_virtual_path

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

FallbackFileSystemResolverインスタンス生成時にvirtual_pathを渡さないよう修正しています。

以前はdecorateメソッドでvirtual_pathが削除されるようになっていたのですが、Don't mutate virtual_path, remove decoratedecorateメソッドが削除された影響でvirtual_pathが渡されるようになっていました。

これにより、rails-controller-testing gemの挙動に影響を与えてしまった為、元の挙動を維持するよう修正しています。

参考:Allow assert_template(file:) to work using Rails 6


Merge pull request #35664 from jeremyevans/remove-roflscaling

Active Recordの修正です。

GROUP BYWHERE等のSQLクエリー使用時に使用する文字列を定数で保持していたのを、定数を使用しないよう修正しています。

元々不要なオブジェクトが生成されるのを避けるために定数を使用していたのですが、frozen string literalsが使用される事になった事で、定数で保持するメリットが無くなった為。


Merge pull request #35656 from larouxn/revert-34277-remove-javascripts-javascripts_engine-options-for-generators

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

javascripts、及び、javascript_engineオプションを削除した、Remove javascripts and javascript_engine options for generatorsをRevertしています。

coffee-railsを引き続き使用するような場合に、これらのオプションが無いとgeneratorで正しくファイルの生成が出来ないため。

が、修正する箇所に誤りがあり、後ほどRevertされています。


Re-add Template#updated_at as deprecated

actionview/lib/action_view/file_template.rbactionview/lib/action_view/template.rbの修正です。

Make Template::Resolver always cacheで削除されたActionView::Template#updated_atを、再度指定出来るよう修正しています。

openになっているattributeだった為、いきなり削除ではなく、まずはdeprecateメッセージを表示するようにしています。


Fix test broken by 04ae0b0b5e594e0bb99c5cd608921745977bcdcd

actionpack/test/controller/show_exceptions_test.rbの修正です。

Instrument middleware processingの対応の影響で、ActionDispatch::ShowExceptionsのテストがエラーになってしまっていたのを修正しています。


Revert "Revert "Remove javascripts and javascript_engine options for generators""

javascripts、及び、javascript_engineオプションを削除した、Remove javascripts and javascript_engine options for generatorsをRevertした、Merge pull request #35656 from larouxn/revert-34277-remove-javascripts-javascripts_engine-options-for-generatorsをRevetしています。

修正する箇所に誤りがあった為。


Merge pull request #35595 from shioyama/generated_attribute_methods_namespaced_constant

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

GeneratedAttributeMethods moduleをmodelのnamespace配下で生成するよう修正しています。

# Before
User.send(:generated_attribute_methods)
# => #<ActiveRecord::AttributeMethods::GeneratedAttributeMethods:0x000056275f3c2aa8>


# After
User.send(:generated_attribute_methods)
# => User::GeneratedAttributeMethods

GeneratedAssociationMethodsはmodelのnamespace配下で生成するようになっており、挙動を合わせる為。


Merge pull request #35649 from andrehjr/fix-override-of-cookies-controller-specs

actionpack/lib/action_dispatch/middleware/cookies.rbの修正です。

CookieJar#update_cookies_from_jarで既に設定済みのkeyについては上書きしないよう修正しています。


Add mention about process_middleware.action_dispatch in the guide [ci skip]

rails guideのActive Support Instrumentationの修正です。

Instrument middleware processingで追加されたprocess_middleware.action_dispatch eventについてguiden説明を追加しています。


Make aliases of database option in generators work

Refactor migrations_path command option to databaseで追加されたgeneratorのdatabaseオプションの、aliasであるdbオプションが指定しても動作しないバグがあったのを修正しています。