actionview 7.1.5.2 → 8.1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -436
  3. data/README.rdoc +1 -1
  4. data/lib/action_view/base.rb +29 -11
  5. data/lib/action_view/buffers.rb +1 -1
  6. data/lib/action_view/cache_expiry.rb +9 -3
  7. data/lib/action_view/dependency_tracker/erb_tracker.rb +37 -28
  8. data/lib/action_view/dependency_tracker/ruby_tracker.rb +43 -0
  9. data/lib/action_view/dependency_tracker/wildcard_resolver.rb +32 -0
  10. data/lib/action_view/dependency_tracker.rb +8 -2
  11. data/lib/action_view/digestor.rb +6 -2
  12. data/lib/action_view/gem_version.rb +3 -3
  13. data/lib/action_view/helpers/asset_tag_helper.rb +39 -8
  14. data/lib/action_view/helpers/atom_feed_helper.rb +1 -3
  15. data/lib/action_view/helpers/cache_helper.rb +10 -2
  16. data/lib/action_view/helpers/capture_helper.rb +2 -2
  17. data/lib/action_view/helpers/controller_helper.rb +6 -2
  18. data/lib/action_view/helpers/csrf_helper.rb +1 -1
  19. data/lib/action_view/helpers/date_helper.rb +28 -4
  20. data/lib/action_view/helpers/form_helper.rb +277 -272
  21. data/lib/action_view/helpers/form_options_helper.rb +39 -35
  22. data/lib/action_view/helpers/form_tag_helper.rb +115 -72
  23. data/lib/action_view/helpers/javascript_helper.rb +5 -1
  24. data/lib/action_view/helpers/number_helper.rb +14 -0
  25. data/lib/action_view/helpers/output_safety_helper.rb +5 -6
  26. data/lib/action_view/helpers/rendering_helper.rb +160 -50
  27. data/lib/action_view/helpers/sanitize_helper.rb +6 -0
  28. data/lib/action_view/helpers/tag_helper.rb +225 -48
  29. data/lib/action_view/helpers/tags/base.rb +11 -9
  30. data/lib/action_view/helpers/tags/check_box.rb +9 -3
  31. data/lib/action_view/helpers/tags/collection_check_boxes.rb +4 -3
  32. data/lib/action_view/helpers/tags/collection_helpers.rb +2 -1
  33. data/lib/action_view/helpers/tags/datetime_field.rb +1 -1
  34. data/lib/action_view/helpers/tags/file_field.rb +7 -2
  35. data/lib/action_view/helpers/tags/hidden_field.rb +1 -1
  36. data/lib/action_view/helpers/tags/label.rb +3 -10
  37. data/lib/action_view/helpers/tags/radio_button.rb +1 -1
  38. data/lib/action_view/helpers/tags/select.rb +6 -1
  39. data/lib/action_view/helpers/tags/select_renderer.rb +6 -4
  40. data/lib/action_view/helpers/tags/text_area.rb +1 -1
  41. data/lib/action_view/helpers/tags/text_field.rb +1 -1
  42. data/lib/action_view/helpers/text_helper.rb +11 -4
  43. data/lib/action_view/helpers/translation_helper.rb +6 -1
  44. data/lib/action_view/helpers/url_helper.rb +42 -90
  45. data/lib/action_view/layouts.rb +9 -11
  46. data/lib/action_view/locale/en.yml +3 -0
  47. data/lib/action_view/log_subscriber.rb +9 -8
  48. data/lib/action_view/railtie.rb +12 -2
  49. data/lib/action_view/record_identifier.rb +22 -1
  50. data/lib/action_view/render_parser/prism_render_parser.rb +139 -0
  51. data/lib/action_view/{ripper_ast_parser.rb → render_parser/ripper_render_parser.rb} +162 -10
  52. data/lib/action_view/render_parser.rb +21 -169
  53. data/lib/action_view/renderer/abstract_renderer.rb +1 -1
  54. data/lib/action_view/renderer/partial_renderer.rb +18 -2
  55. data/lib/action_view/renderer/renderer.rb +32 -38
  56. data/lib/action_view/renderer/streaming_template_renderer.rb +8 -2
  57. data/lib/action_view/renderer/template_renderer.rb +3 -3
  58. data/lib/action_view/rendering.rb +6 -7
  59. data/lib/action_view/structured_event_subscriber.rb +97 -0
  60. data/lib/action_view/template/error.rb +18 -3
  61. data/lib/action_view/template/handlers/erb/erubi.rb +1 -1
  62. data/lib/action_view/template/handlers/erb.rb +77 -44
  63. data/lib/action_view/template/raw_file.rb +4 -0
  64. data/lib/action_view/template/renderable.rb +7 -1
  65. data/lib/action_view/template/resolver.rb +0 -3
  66. data/lib/action_view/template.rb +39 -12
  67. data/lib/action_view/test_case.rb +57 -62
  68. data/lib/action_view.rb +4 -0
  69. metadata +17 -14
  70. data/lib/action_view/dependency_tracker/ripper_tracker.rb +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aeec9b1f8aa7329a12b915a01643502803b90d4d27fb7ccce1bd0ce83259ebf
4
- data.tar.gz: 3a1a8e48e41c1bfc2dd55ef5d62a155db86ff94dfc5575665e96ae3a5b6e1cb7
3
+ metadata.gz: a1521bfb9856b6242ae47c76c2840487ba568ba60f317c49bbe27f8e7177425c
4
+ data.tar.gz: 25e34f4fd9a84725ccbc9b47556321e680a8de1f32ed19653d37545da687b631
5
5
  SHA512:
6
- metadata.gz: 78166989c02e7657381b83bcb34dcb7867c2d866fa282d2db7ad4c25b9c874499d8e6a0bcbce1bb94ec83d0db48d789da15211abe197a309b0e21718be996c74
7
- data.tar.gz: 204df71ee43e468f66334d81d55617da2badea9e0ac18c12cbd17e0771e5d376ad549db5986cd44b838bdeb5e562622e7dd4dc7ee3829289ccd619461b9ec3ed
6
+ metadata.gz: 3f0c3405cf8676fcd7d1f37faf05a5376ecb0b73581f728143a57072e202eab34b5157d719affb4bff42beabd461512a010028b5f1edae096111b9fd1e3648b5
7
+ data.tar.gz: 18b2e2270c57343cce22f1e69978e7739d328a657b49313643bc43bc9ee667ec90ae807ad1be87b973e5ff80ff4a1ca5273c259105c879555d5fed1ebd6f215e
data/CHANGELOG.md CHANGED
@@ -1,521 +1,181 @@
1
- ## Rails 7.1.5.2 (August 13, 2025) ##
1
+ ## Rails 8.1.2.1 (March 23, 2026) ##
2
2
 
3
- * No changes.
3
+ * Fix possible XSS in DebugExceptions middleware
4
4
 
5
+ [CVE-2026-33167]
5
6
 
6
- ## Rails 7.1.5.1 (December 10, 2024) ##
7
+ *John Hawthorn*
7
8
 
8
- * No changes.
9
+ * Skip blank attribute names in tag helpers to avoid generating invalid HTML.
9
10
 
11
+ [CVE-2026-33168]
10
12
 
11
- ## Rails 7.1.5 (October 30, 2024) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 7.1.4.2 (October 23, 2024) ##
17
-
18
- * No changes.
19
-
20
-
21
- ## Rails 7.1.4.1 (October 15, 2024) ##
22
-
23
- * No changes.
24
-
25
-
26
- ## Rails 7.1.4 (August 22, 2024) ##
27
-
28
- * Action View Test Case `rendered` memoization.
29
-
30
- *Sean Doyle*
31
-
32
- * Restore the ability for templates to return any kind of object and not just strings
33
-
34
- *Jean Boussier*
35
-
36
- * Fix threading issue with strict locals.
37
-
38
- *Robert Fletcher*
39
-
40
-
41
- ## Rails 7.1.3.4 (June 04, 2024) ##
42
-
43
- * No changes.
44
-
45
-
46
- ## Rails 7.1.3.3 (May 16, 2024) ##
47
-
48
- * No changes.
49
-
50
-
51
- ## Rails 7.1.3.2 (February 21, 2024) ##
52
-
53
- * No changes.
54
-
55
-
56
- ## Rails 7.1.3.1 (February 21, 2024) ##
57
-
58
- * No changes.
59
-
60
-
61
- ## Rails 7.1.3 (January 16, 2024) ##
62
-
63
- * Better handle SyntaxError in Action View.
64
-
65
- *Mario Caropreso*
66
-
67
- * Fix `word_wrap` with empty string.
68
-
69
- *Jonathan Hefner*
70
-
71
- * Rename `ActionView::TestCase::Behavior::Content` to `ActionView::TestCase::Behavior::RenderedViewContent`.
72
-
73
- Make `RenderedViewContent` inherit from `String`. Make private API with `:nodoc:`.
74
-
75
- *Sean Doyle*
76
-
77
- * Fix detection of required strict locals.
78
-
79
- Further fix `render @collection` compatibility with strict locals
80
-
81
- *Jean Boussier*
82
-
83
-
84
- ## Rails 7.1.2 (November 10, 2023) ##
85
-
86
- * Fix the `number_to_human_size` view helper to correctly work with negative numbers.
87
-
88
- *Earlopain*
89
-
90
- * Automatically discard the implicit locals injected by collection rendering for template that can't accept them
91
-
92
- When rendering a collection, two implicit variables are injected, which breaks templates with strict locals.
93
-
94
- Now they are only passed if the template will actually accept them.
95
-
96
- *Yasha Krasnou*, *Jean Boussier*
97
-
98
- * Fix `@rails/ujs` calling `start()` an extra time when using bundlers
99
-
100
- *Hartley McGuire*, *Ryunosuke Sato*
101
-
102
- * Fix the `capture` view helper compatibility with HAML and Slim
103
-
104
- When a blank string was captured in HAML or Slim (and possibly other template engines)
105
- it would instead return the entire buffer.
106
-
107
- *Jean Boussier*
108
-
109
-
110
- ## Rails 7.1.1 (October 11, 2023) ##
111
-
112
- * Updated `@rails/ujs` files to ignore certain data-* attributes when element is contenteditable.
113
-
114
- This fix was already landed in >= 7.0.4.3, < 7.1.0.
115
- [[CVE-2023-23913](https://github.com/advisories/GHSA-xp5h-f8jf-rc8q)]
116
-
117
- *Ryunosuke Sato*
118
-
119
-
120
- ## Rails 7.1.0 (October 05, 2023) ##
121
-
122
- * No changes.
123
-
124
-
125
- ## Rails 7.1.0.rc2 (October 01, 2023) ##
126
-
127
- * No changes.
128
-
129
-
130
- ## Rails 7.1.0.rc1 (September 27, 2023) ##
131
-
132
- * Introduce `ActionView::TestCase.register_parser`
133
-
134
- ```ruby
135
- register_parser :rss, -> rendered { RSS::Parser.parse(rendered) }
136
-
137
- test "renders RSS" do
138
- article = Article.create!(title: "Hello, world")
139
-
140
- render formats: :rss, partial: article
141
-
142
- assert_equal "Hello, world", rendered.rss.items.last.title
143
- end
144
- ```
145
-
146
- By default, register parsers for `:html` and `:json`.
147
-
148
- *Sean Doyle*
149
-
150
-
151
- ## Rails 7.1.0.beta1 (September 13, 2023) ##
152
-
153
- * Fix `simple_format` with blank `wrapper_tag` option returns plain html tag
154
-
155
- By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
156
- the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
157
-
158
- Before:
159
-
160
- ```ruby
161
- simple_format("Hello World", {}, { wrapper_tag: nil })
162
- # <>Hello World</>
163
- ```
164
-
165
- After:
166
-
167
- ```ruby
168
- simple_format("Hello World", {}, { wrapper_tag: nil })
169
- # <p>Hello World</p>
170
- ```
171
-
172
- *Akhil G Krishnan*, *Junichi Ito*
173
-
174
- * Don't double-encode nested `field_id` and `field_name` index values
13
+ *Mike Dalessio*
175
14
 
176
- Pass `index: @options` as a default keyword argument to `field_id` and
177
- `field_name` view helper methods.
178
15
 
179
- *Sean Doyle*
16
+ ## Rails 8.1.2 (January 08, 2026) ##
180
17
 
181
- * Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
18
+ * Fix `file_field` to join mime types with a comma when provided as Array
182
19
 
183
20
  ```ruby
184
- # will exclude header, even if setting is enabled:
185
- javascript_include_tag("http://example.com/all.js", preload_links_header: false)
186
-
187
- # will include header, even if setting is disabled:
188
- stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
21
+ file_field(:article, :image, accept: ['image/png', 'image/gif', 'image/jpeg'])
189
22
  ```
190
23
 
191
- *Alex Ghiculescu*
192
-
193
- * Stop generating `Link preload` headers once it has reached 1KB.
24
+ Now behaves likes:
194
25
 
195
- Some proxies have trouble handling large headers, but more importantly preload links
196
- have diminishing returns so it's preferable not to go overboard with them.
197
-
198
- If tighter control is needed, it's recommended to disable automatic generation of preloads
199
- and to generate them manually from the controller or from a middleware.
200
-
201
- *Jean Boussier*
202
-
203
- * `simple_format` helper now handles a `:sanitize_options` - any extra options you want appending to the sanitize.
204
-
205
- Before:
206
- ```ruby
207
- simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>")
208
- # => "<p><a href=\"http://example.com\">Continue</a></p>"
209
26
  ```
210
-
211
- After:
212
- ```ruby
213
- simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>", {}, { sanitize_options: { attributes: %w[target href] } })
214
- # => "<p><a target=\"_blank\" href=\"http://example.com\">Continue</a></p>"
27
+ file_field(:article, :image, accept: 'image/png,image/gif,image/jpeg')
215
28
  ```
216
29
 
217
- *Andrei Andriichuk*
30
+ *Bogdan Gusiev*
218
31
 
219
- * Add support for HTML5 standards-compliant sanitizers, and default to `Rails::HTML5::Sanitizer`
220
- in the Rails 7.1 configuration if it is supported.
32
+ * Fix strict locals parsing to handle multiline definitions.
221
33
 
222
- Action View's HTML sanitizers can be configured by setting
223
- `config.action_view.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or
224
- `Rails::HTML5::Sanitizer`.
34
+ *Said Kaldybaev*
225
35
 
226
- The Rails 7.1 configuration will set this to `Rails::HTML5::Sanitizer` when it is supported, and
227
- fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to
228
- `Rails::HTML4::Sanitizer`.
36
+ * Fix `content_security_policy_nonce` error in mailers when using `content_security_policy_nonce_auto` setting.
229
37
 
230
- *Mike Dalessio*
38
+ The `content_security_policy_nonce helper` is provided by `ActionController::ContentSecurityPolicy`, and it relies on `request.content_security_policy_nonc`e. Mailers lack both the module and the request object.
231
39
 
232
- * `config.dom_testing_default_html_version` controls the HTML parser used by
233
- `ActionView::TestCase#document_root_element`, which creates the DOM used by the assertions in
234
- Rails::Dom::Testing.
40
+ *Jarrett Lusso*
235
41
 
236
- The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better
237
- represent what the DOM would be in a browser user agent. Previously this test helper always used
238
- Nokogiri's HTML4 parser.
239
42
 
240
- *Mike Dalessio*
43
+ ## Rails 8.1.1 (October 28, 2025) ##
241
44
 
242
- * Add support for the HTML picture tag. It supports passing a String, an Array or a Block.
243
- Supports passing properties directly to the img tag via the `:image` key.
244
- Since the picture tag requires an img tag, the last element you provide will be used for the img tag.
245
- For complete control over the picture tag, a block can be passed, which will populate the contents of the tag accordingly.
246
-
247
- Can be used like this for a single source:
248
- ```erb
249
- <%= picture_tag("picture.webp") %>
250
- ```
251
- which will generate the following:
252
- ```html
253
- <picture>
254
- <img src="/images/picture.webp" />
255
- </picture>
256
- ```
257
-
258
- For multiple sources:
259
- ```erb
260
- <%= picture_tag("picture.webp", "picture.png", :class => "mt-2", :image => { alt: "Image", class: "responsive-img" }) %>
261
- ```
262
- will generate:
263
- ```html
264
- <picture class="mt-2">
265
- <source srcset="/images/picture.webp" />
266
- <source srcset="/images/picture.png" />
267
- <img alt="Image" class="responsive-img" src="/images/picture.png" />
268
- </picture>
269
- ```
270
-
271
- Full control via a block:
272
- ```erb
273
- <%= picture_tag(:class => "my-class") do %>
274
- <%= tag(:source, :srcset => image_path("picture.webp")) %>
275
- <%= tag(:source, :srcset => image_path("picture.png")) %>
276
- <%= image_tag("picture.png", :alt => "Image") %>
277
- <% end %>
278
- ```
279
- will generate:
280
- ```html
281
- <picture class="my-class">
282
- <source srcset="/images/picture.webp" />
283
- <source srcset="/images/picture.png" />
284
- <img alt="Image" src="/images/picture.png" />
285
- </picture>
286
- ```
287
-
288
- *Juan Pablo Balarini*
289
-
290
- * Remove deprecated support to passing instance variables as locals to partials.
45
+ * Respect `remove_hidden_field_autocomplete` config in form builder `hidden_field`.
291
46
 
292
47
  *Rafael Mendonça França*
293
48
 
294
- * Remove deprecated constant `ActionView::Path`.
295
49
 
296
- *Rafael Mendonça França*
297
-
298
- * Guard `token_list` calls from escaping HTML too often
299
-
300
- *Sean Doyle*
50
+ ## Rails 8.1.0 (October 22, 2025) ##
301
51
 
302
- * `select` can now be called with a single hash containing options and some HTML options
303
-
304
- Previously this would not work as expected:
305
-
306
- ```erb
307
- <%= select :post, :author, authors, required: true %>
308
- ```
309
-
310
- Instead you needed to do this:
311
-
312
- ```erb
313
- <%= select :post, :author, authors, {}, required: true %>
314
- ```
315
-
316
- Now, either form is accepted, for the following HTML attributes: `required`, `multiple`, `size`.
317
-
318
- *Alex Ghiculescu*
319
-
320
- * Datetime form helpers (`time_field`, `date_field`, `datetime_field`, `week_field`, `month_field`) now accept an instance of Time/Date/DateTime as `:value` option.
52
+ * 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.
321
53
 
322
54
  Before:
323
- ```erb
324
- <%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
55
+ ```
56
+ <!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb --><p>This is grand!</p>
325
57
  ```
326
58
 
327
59
  After:
328
- ```erb
329
- <%= form.datetime_field :written_at, value: Time.current %>
330
60
  ```
331
-
332
- *Andrey Samsonov*
333
-
334
- * Choices of `select` can optionally contain html attributes as the last element
335
- of the child arrays when using grouped/nested collections
336
-
337
- ```erb
338
- <%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
339
- # => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
61
+ <!-- BEGIN /Users/siaw23/Desktop/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb
62
+ --><p>This is grand!</p>
340
63
  ```
64
+ *Emmanuel Hayford*
341
65
 
342
- *Chris Gunther*
343
-
344
- * `check_box_tag` and `radio_button_tag` now accept `checked` as a keyword argument
345
-
346
- This is to make the API more consistent with the `FormHelper` variants. You can now
347
- provide `checked` as a positional or keyword argument:
66
+ * Add structured events for Action View:
67
+ - `action_view.render_template`
68
+ - `action_view.render_partial`
69
+ - `action_view.render_layout`
70
+ - `action_view.render_collection`
71
+ - `action_view.render_start`
348
72
 
349
- ```erb
350
- = check_box_tag "admin", "1", false
351
- = check_box_tag "admin", "1", checked: false
73
+ *Gannon McGibbon*
352
74
 
353
- = radio_button_tag 'favorite_color', 'maroon', false
354
- = radio_button_tag 'favorite_color', 'maroon', checked: false
355
- ```
75
+ * Fix label with `for` option not getting prefixed by form `namespace` value
356
76
 
357
- *Alex Ghiculescu*
77
+ *Abeid Ahmed*, *Hartley McGuire*
358
78
 
359
- * Allow passing a class to `dom_id`.
360
- You no longer need to call `new` when passing a class to `dom_id`.
361
- This makes `dom_id` behave like `dom_class` in this regard.
362
- Apart from saving a few keystrokes, it prevents Ruby from needing
363
- to instantiate a whole new object just to generate a string.
79
+ * Add `fetchpriority` to Link headers to match HTML generated by `preload_link_tag`.
364
80
 
365
- Before:
366
- ```ruby
367
- dom_id(Post) # => NoMethodError: undefined method `to_key' for Post:Class
368
- ```
369
-
370
- After:
371
- ```ruby
372
- dom_id(Post) # => "new_post"
373
- ```
81
+ *Guillermo Iguaran*
374
82
 
375
- *Goulven Champenois*
83
+ * Add CSP `nonce` to Link headers generated by `preload_link_tag`.
376
84
 
377
- * Report `:locals` as part of the data returned by ActionView render instrumentation.
85
+ *Alexander Gitter*
378
86
 
379
- Before:
380
- ```ruby
381
- {
382
- identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
383
- layout: "layouts/application"
384
- }
385
- ```
87
+ * Allow `current_page?` to match against specific HTTP method(s) with a `method:` option.
386
88
 
387
- After:
388
- ```ruby
389
- {
390
- identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
391
- layout: "layouts/application",
392
- locals: {foo: "bar"}
393
- }
394
- ```
89
+ *Ben Sheldon*
395
90
 
396
- *Aaron Gough*
91
+ * Remove `autocomplete="off"` on hidden inputs generated by the following
92
+ tags:
397
93
 
398
- * Strip `break_sequence` at the end of `word_wrap`.
94
+ * `form_tag`, `token_tag`, `method_tag`
399
95
 
400
- This fixes a bug where `word_wrap` didn't properly strip off break sequences that had printable characters.
96
+ As well as the hidden parameter fields included in `button_to`,
97
+ `check_box`, `select` (with `multiple`) and `file_field` forms.
401
98
 
402
- For example, compare the outputs of this template:
99
+ *nkulway*
403
100
 
404
- ```erb
405
- # <%= word_wrap("11 22\n33 44", line_width: 2, break_sequence: "\n# ") %>
406
- ```
101
+ * Enable configuring the strategy for tracking dependencies between Action
102
+ View templates.
407
103
 
408
- Before:
104
+ The existing `:regex` strategy is kept as the default, but with
105
+ `load_defaults 8.1` the strategy will be `:ruby` (using a real Ruby parser).
409
106
 
410
- ```
411
- # 11
412
- # 22
413
- #
414
- # 33
415
- # 44
416
- #
417
- ```
107
+ *Hartley McGuire*
418
108
 
419
- After:
109
+ * Introduce `relative_time_in_words` helper
420
110
 
111
+ ```ruby
112
+ relative_time_in_words(3.minutes.from_now) # => "in 3 minutes"
113
+ relative_time_in_words(3.minutes.ago) # => "3 minutes ago"
114
+ relative_time_in_words(10.seconds.ago, include_seconds: true) # => "less than 10 seconds ago"
421
115
  ```
422
- # 11
423
- # 22
424
- # 33
425
- # 44
426
- ```
427
-
428
- *Max Chernyak*
429
116
 
430
- * Allow templates to set strict `locals`.
431
-
432
- By default, templates will accept any `locals` as keyword arguments. To define what `locals` a template accepts, add a `locals` magic comment:
433
-
434
- ```erb
435
- <%# locals: (message:) -%>
436
- <%= message %>
437
- ```
117
+ *Matheus Richard*
438
118
 
439
- Default values can also be provided:
119
+ * Make `nonce: false` remove the nonce attribute from `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`.
440
120
 
441
- ```erb
442
- <%# locals: (message: "Hello, world!") -%>
443
- <%= message %>
444
- ```
121
+ *francktrouillez*
445
122
 
446
- Or `locals` can be disabled entirely:
123
+ * Add `dom_target` helper to create `dom_id`-like strings from an unlimited
124
+ number of objects.
447
125
 
448
- ```erb
449
- <%# locals: () %>
450
- ```
126
+ *Ben Sheldon*
451
127
 
452
- *Joel Hawksley*
128
+ * Respect `html_options[:form]` when `collection_checkboxes` generates the
129
+ hidden `<input>`.
453
130
 
454
- * Add `include_seconds` option for `datetime_local_field`
131
+ *Riccardo Odone*
455
132
 
456
- This allows to omit seconds part in the input field, by passing `include_seconds: false`
133
+ * Layouts have access to local variables passed to `render`.
457
134
 
458
- *Wojciech Wnętrzak*
135
+ This fixes #31680 which was a regression in Rails 5.1.
459
136
 
460
- * Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
461
- `object_name` arguments. For example:
137
+ *Mike Dalessio*
462
138
 
463
- ```erb
464
- <%= fields do |f| %>
465
- <%= f.field_name :body %>
466
- <% end %>
467
- ```
139
+ * Argument errors related to strict locals in templates now raise an
140
+ `ActionView::StrictLocalsError`, and all other argument errors are reraised as-is.
468
141
 
469
- *Sean Doyle*
142
+ Previously, any `ArgumentError` raised during template rendering was swallowed during strict
143
+ local error handling, so that an `ArgumentError` unrelated to strict locals (e.g., a helper
144
+ method invoked with incorrect arguments) would be replaced by a similar `ArgumentError` with an
145
+ unrelated backtrace, making it difficult to debug templates.
470
146
 
471
- * Strings returned from `strip_tags` are correctly tagged `html_safe?`
147
+ Now, any `ArgumentError` unrelated to strict locals is reraised, preserving the original
148
+ backtrace for developers.
472
149
 
473
- Because these strings contain no HTML elements and the basic entities are escaped, they are safe
474
- to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping
475
- entities when being concatenated to a SafeBuffer during rendering.
150
+ Also note that `ActionView::StrictLocalsError` is a subclass of `ArgumentError`, so any existing
151
+ code that rescues `ArgumentError` will continue to work.
476
152
 
477
- Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124)
153
+ Fixes #52227.
478
154
 
479
155
  *Mike Dalessio*
480
156
 
481
- * Move `convert_to_model` call from `form_for` into `form_with`
157
+ * Improve error highlighting of multi-line methods in ERB templates or
158
+ templates where the error occurs within a do-end block.
482
159
 
483
- Now that `form_for` is implemented in terms of `form_with`, remove the
484
- `convert_to_model` call from `form_for`.
160
+ *Martin Emde*
485
161
 
486
- *Sean Doyle*
162
+ * Fix a crash in ERB template error highlighting when the error occurs on a
163
+ line in the compiled template that is past the end of the source template.
487
164
 
488
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
165
+ *Martin Emde*
489
166
 
490
- Escape dangerous characters in names of tags and names of attributes in the
491
- tag helpers, following the XML specification. Rename the option
492
- `:escape_attributes` to `:escape`, to simplify by applying the option to the
493
- whole tag.
167
+ * Improve reliability of ERB template error highlighting.
168
+ Fix infinite loops and crashes in highlighting and
169
+ improve tolerance for alternate ERB handlers.
494
170
 
495
- *Álvaro Martín Fraguas*
171
+ *Martin Emde*
496
172
 
497
- * Extend audio_tag and video_tag to accept Active Storage attachments.
173
+ * Allow `hidden_field` and `hidden_field_tag` to accept a custom autocomplete value.
498
174
 
499
- Now it's possible to write
500
-
501
- ```ruby
502
- audio_tag(user.audio_file)
503
- video_tag(user.video_file)
504
- ```
505
-
506
- Instead of
507
-
508
- ```ruby
509
- audio_tag(polymorphic_path(user.audio_file))
510
- video_tag(polymorphic_path(user.video_file))
511
- ```
512
-
513
- `image_tag` already supported that, so this follows the same pattern.
514
-
515
- *Matheus Richard*
175
+ *brendon*
516
176
 
517
- * Ensure models passed to `form_for` attempt to call `to_model`.
177
+ * Add a new configuration `content_security_policy_nonce_auto` for automatically adding a nonce to the tags affected by the directives specified by the `content_security_policy_nonce_directives` configuration option.
518
178
 
519
- *Sean Doyle*
179
+ *francktrouillez*
520
180
 
521
- Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionview/CHANGELOG.md) for previous changes.
181
+ Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionview/CHANGELOG.md) for previous changes.
data/README.rdoc CHANGED
@@ -35,6 +35,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
35
35
 
36
36
  * https://github.com/rails/rails/issues
37
37
 
38
- Feature requests should be discussed on the rails-core mailing list here:
38
+ Feature requests should be discussed on the rubyonrails-core forum here:
39
39
 
40
40
  * https://discuss.rubyonrails.org/c/rubyonrails-core