なるようになるブログ

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

rails commit log流し読み(2020/12/01)

2020/12/01分のコミットです。

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

activesupport/CHANGELOG.md

actionview/CHANGELOG.md


Added test cases for Action Mailbox generator

railties/test/generators/action_mailbox_install_generator_test.rbの修正です。

Action Mailbox generatorのテストを追加しています。


Unify decorate_attribute_type and attribute

Active Recordの修正です。

decorate_attribute_typeattributeをマージしています。attributesがtypeとvalueを個別に設定出来るようにするた為。


Fix the return value of #deep_transform_keys from a Hash to a HashWithIndifferentAccess

activesupport/lib/active_support/core_ext/hash/keys.rbの修正です。

`HashWithIndifferentAccess#deep_transform_keysの戻り値がHashになっていたのをHashWithIndifferentAccessになるよう修正しています。


Always recommend config.asset_host in examples

docの修正です。

asset_hostの設定をするexampleに、config.action_controllerconfig.action_mailer経由で設定するようになっている箇所があったのを、config.asset_host経由で設定するよう修正しています。


Merge pull request #40709 from francois-ferrandis/update-guide-on-delivery-method-in-callbacks

rails guideのAction Mailer Basicsの修正です。

callback について説明しているexampleコードで、インスタンス変数をbefore_actionのblock内で直接行っていたのを、メソッドで行うよう修正しています。


Merge pull request #40503 from juanmanuelramallo/increase-worker-timeout-in-development

railties/lib/rails/generators/rails/app/templates/config/puma.rb.ttの修正です。

RAILS_ENVdevelopmentの場合に、worker_timeout3600を指定するよう修正しています。

Puma 5からworkerのtimeout checkが導入されたのですが、その影響で、開発時にbyebugを使ってデバッグしていてレスポンスが返るのに時間が掛かるような場合に、timeoutが発生するようになってしまいました。

デバッグをしているような場合にtimeoutが発生するのを避ける為、development envの場合のみworker_timeoutに長めの値を指定するよう修正しています。


Merge pull request #40045 from sandip-mane/40041-hosts-case-fix

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

Host Authorizationで許可されたホストのチェックをする際に、case-insensitive matchingを行うよう修正しています。


Declare ActionView::Helpers::FormBuilder#id

Action Viewの修正です。

指定されたattribute nameで生成されたidを取得する為のActionView::Helpers::FormBuilder#field_idメソッド、及び、<form>エレメントの id attributeを取得する為のActionView::Helpers::FormBuilder#idメソッドを追加しています。


Merge pull request #39472

activejob/lib/active_job/railtie.rbの修正です。

config.active_jobに不正なkeyが指定された場合にエラーになるよう修正しています。


Mark scrub as an unsafe method on SafeBuffer

activesupport/lib/active_support/core_ext/string/output_safety.rbの修正です。

SafeBufferのunsafe methodの一覧にscrubメソッドを追加しています。


Merge pull request #40663 from amatsuda/keep_safe_buffer

activesupport/lib/active_support/core_ext/string/output_safety.rbの修正です。

ActiveSupport::SafeBuffer#[]*メソッドで戻り値をSafeBufferインスタンスとなるよう修正しています。

Ruby 3では、サブクラスのインスタンスで呼び出されたときに、すべてのStringメソッドがStringのインスタンスを返す、という非互換が導入されており、その非互換を避けRuby 2までと同じ挙動になるようにする為に修正を行っています。

参考: Bug #10845: Subclassing String