🔗 Action View CHANGELOG
参考: Release 8.1.0.beta1 · rails/rails
参考: コミットリスト: Comparing v8.0.2.1...v8.1.0.beta1 · rails/rails
🔗 Allow current_page?
to match against specific HTTP method(s) with a method:
option by bensheldon · Pull Request #55286 · rails/rails
current_page?
ヘルパーでmethod:
オプションが追加された。これによりHTTPメソッドをmethod: [:post, :put, :delete]
のように指定可能になった。Ben Sheldon
同Changelogより
🔗 [Fix #55209] Remove autocomplete="off" from hidden inputs in button_to by nkulway · Pull Request #55336 · rails/rails
button_to
フォームに含まれるhiddenパラメータフィールドがautocomplete="off"
を含まないようになった。これは、UrlHelper
のhidden入力からautocomplete="off"
属性を削除する目的で行われた。また、form_tag
(非推奨)やtoken_tag
(Rails 4で廃止)やmethod_tag
(privateメソッド)で生成されるhidden入力もautocomplete="off"
を含まなくなる。nkulway
同Changelogより
#55336については、config.action_view.remove_hidden_field_autocomplete
コンフィグが追加され、上述の挙動をオンオフできます。
Starting with version | The default value is |
---|---|
(original) | false |
8.1 | true |
🔗 Enable configuring Action View's render tracker by skipkayhil · Pull Request #55194 · rails/rails
Action Viewテンプレート間の依存関係をトラッキングする戦略をコンフィグ可能になった。
従来の
:regex
戦略はデフォルトとして保持されるが、load_defaults 8.1
では:ruby
(本物のRubyパーサーを使う)戦略が使われるようになる。Hartley McGuire
同Changelogより
🔗 Add relative_time_in_words
helper to ActionView by MatheusRich · Pull Request #55405 · rails/rails
相対時間を英文で返す
relative_time_in_words
ヘルパーを追加。relative_time_in_words(3.minutes.from_now) # => "in 3 minutes" relative_time_in_words(3.minutes.ago) # => "3 minutes ago" relative_time_in_words(10.seconds.ago, include_seconds: true) # => "less than 10 seconds ago"
Matheus Richard
同Changelogより
🔗 Make nonce: false
remove the nonce attribute for javascript_tag
, javascript_include_tag
and stylesheet_link_tag
by francktrouillez · Pull Request #54724 · rails/rails
nonce: false
を指定したときに、以下の出力からnonce属性そのものを削除するようになった(従来はnonce="false"
が追加されていた)。francktrouillez
同Changelogより
🔗 Add dom_target
helper to create dom_id
-like strings from an unlimited number of objects by bensheldon · Pull Request #55204 · rails/rails
dom_target
ヘルパーを追加。これはdom_id
のような文字列をオブジェクトから生成するが、オブジェクト数に上限はない。Ben Sheldon
同Changelogより
🔗 Use the given form
in html_options
for the hidden field in collection_check_boxes
by 3v0k4 · Pull Request #51746 · rails/rails
collection_checkboxes
ヘルパーで生成したhiddenの<input>
タグをhtml_options[:form]
に渡しても無視されていた(#51606)のを修正。Riccardo Odone
同Changelogより
🔗 (https://github.com/rails/rails/pull/54020
コントローラで
render
に渡したlocals
にレイアウトからアクセスできなくなっていたのを修正。修正された#31680はRails 5.1のリグレッションバグ。
Mike Dalessio
同Changelogより
🔗 fix: ArgumentError
s raised during template rendering by flavorjones · Pull Request #54133 · rails/rails
テンプレート内の引数エラーのうち、strict(厳密な)
locals
に関連するものはActionView::StrictLocalsError
をraiseし、その他の引数エラーはそのまま再度raiseされるようになった。従来は、テンプレートのレンダリング中にraiseした
ArgumentError
はstrictlocals
エラーの処理中に飲み込まれてしまっていたため、strictlocals
に関連しないArgumentError
(誤った引数で呼び出されたヘルパーメソッドなど)が無関係なバックトレースを持つ同様のArgumentError
に置き換えられてしまい、テンプレートのデバッグが困難になっていた。修正後は、strict
locals
に関連しないArgumentError
が再度raiseされるようになり、開発者向けに元のバックトレースが保持されるようになった。また、
ActionView::StrictLocalsError
はArgumentError
のサブクラスであるため、ArgumentError
をrescueする既存のコードは引き続き機能する。修正: #52227
Mike Dalessio
同Changelogより
🔗 Improve error highlighting of multiline methods in ERB templates by martinemde · Pull Request #53763 · rails/rails
ERBテンプレート内の複数行メソッドや、エラーがテンプレート
do
-end
ブロック内で発生した場合のエラーハイライトが不適切だったのを修正。Martin Emde
同Changelogより
🔗 fix: ArgumentError
s raised during template rendering by flavorjones · Pull Request #54133 · rails/rails
ERBテンプレートで発生したエラーが、コンパイル済みテンプレートのソーステンプレートの末尾より下の行で発生すると、ERBテンプレートのエラーハイライトがクラッシュする問題を修正。
Martin Emde
同Changelogより
🔗 Redesign ActionView::Template::Handlers::ERB.find_offset to handle edge cases by martinemde · Pull Request #53657 · rails/rails
ERBテンプレートでのエラーハイライトの信頼性を改善した。
エラーハイライト表示での無限ループやクラッシュを修正し、Rails以外のERBハンドラでの動作を改良した。Martin Emde
同Changelogより
🔗 Allow hidden_field(_tag) to accept a custom autocomplete value by brendon · Pull Request #53512 · rails/rails
hidden_field
とhidden_field_tag
にカスタムのオートコンプリート値を渡せるようになった。brendon
同Changelogより
補足: 従来はFirefoxのバグ対応のため、hiddenフィールドにautocomplete="off"
が強制的に追加されていました(#43280)が、これはパスワードマネージャがusername
などをhiddenフィールドに設定するうえで不都合があるため、他のautocomplete
値が設定されていない場合にのみautocomplete="off"
をhiddenフィールドに追加するよう修正されました。
🔗 Add a config for automatically including nonce
in javascript_tag
, javascript_include_tag
and stylesheet_link_tag
by francktrouillez · Pull Request #53835 · rails/rails
content_security_policy_nonce_auto
コンフィグを新たに追加。
これは、既存のcontent_security_policy_nonce_directives
コンフィグで指定されたディレクティブに影響されるタグに自動的にnonceを追加する。francktrouillez
同Changelogより
breaking changesの可能性があるプルリク・コミット
個別のプルリクにも目印として★を追加しています。