Rails 8.1.0 (October 22, 2025)¶ ↑
-
The BEGIN template annotation/comment was previously printed on the same line as the following element. We now insert a newline inside the comment so it spans two lines without adding visible whitespace to the HTML output to enhance readability.
Before:
<!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb --><p>This is grand!</p>
After:
<!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb --><p>This is grand!</p>
Emmanuel Hayford
-
Add structured events for Action View:
-
action_view.render_template -
action_view.render_partial -
action_view.render_layout -
action_view.render_collection -
action_view.render_start
Gannon McGibbon
-
-
Fix label with
foroption not getting prefixed by formnamespacevalueAbeid Ahmed, Hartley McGuire
-
Add
fetchpriorityto Link headers to match HTML generated bypreload_link_tag.Guillermo Iguaran
-
Add CSP
nonceto Link headers generated bypreload_link_tag.Alexander Gitter
-
Allow
current_page?to match against specific HTTP method(s) with amethod:option.Ben Sheldon
-
Remove
autocomplete="off"on hidden inputs generated by the following tags:-
form_tag,token_tag,method_tag
As well as the hidden parameter fields included in
button_to,check_box,select(withmultiple) andfile_fieldforms.nkulway
-
-
Enable configuring the strategy for tracking dependencies between Action View templates.
The existing
:regexstrategy is kept as the default, but withload_defaults 8.1the strategy will be:ruby(using a real Ruby parser).Hartley McGuire
-
Introduce
relative_time_in_wordshelperrelative_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
-
Make
nonce: falseremove the nonce attribute fromjavascript_tag,javascript_include_tag, andstylesheet_link_tag.francktrouillez
-
Add
dom_targethelper to createdom_id-like strings from an unlimited number of objects.Ben Sheldon
-
Respect
html_options[:form]whencollection_checkboxesgenerates the hidden<input>.Riccardo Odone
-
Layouts have access to local variables passed to
render.This fixes #31680 which was a regression in
Rails5.1.Mike Dalessio
-
Argument errors related to strict locals in templates now raise an
ActionView::StrictLocalsError, and all other argument errors are reraised as-is.Previously, any
ArgumentErrorraised during template rendering was swallowed during strict local error handling, so that anArgumentErrorunrelated to strict locals (e.g., a helper method invoked with incorrect arguments) would be replaced by a similarArgumentErrorwith an unrelated backtrace, making it difficult to debug templates.Now, any
ArgumentErrorunrelated to strict locals is reraised, preserving the original backtrace for developers.Also note that
ActionView::StrictLocalsErroris a subclass ofArgumentError, so any existing code that rescuesArgumentErrorwill continue to work.Fixes #52227.
Mike Dalessio
-
Improve error highlighting of multi-line methods in
ERBtemplates or templates where the error occurs within a do-end block.Martin Emde
-
Fix a crash in
ERBtemplate error highlighting when the error occurs on a line in the compiled template that is past the end of the source template.Martin Emde
-
Improve reliability of
ERBtemplate error highlighting. Fix infinite loops and crashes in highlighting and improve tolerance for alternateERBhandlers.Martin Emde
-
Allow
hidden_fieldandhidden_field_tagto accept a custom autocomplete value.brendon
-
Add a new configuration
content_security_policy_nonce_autofor automatically adding a nonce to the tags affected by the directives specified by thecontent_security_policy_nonce_directivesconfiguration option.francktrouillez
Please check 8-0-stable for previous changes.