actionview 6.0.0 → 6.1.0

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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +169 -162
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/action_view/base.rb +21 -52
  6. data/lib/action_view/cache_expiry.rb +1 -3
  7. data/lib/action_view/context.rb +0 -1
  8. data/lib/action_view/dependency_tracker.rb +10 -4
  9. data/lib/action_view/digestor.rb +3 -2
  10. data/lib/action_view/flows.rb +0 -1
  11. data/lib/action_view/gem_version.rb +1 -1
  12. data/lib/action_view/helpers/active_model_helper.rb +0 -1
  13. data/lib/action_view/helpers/asset_tag_helper.rb +41 -16
  14. data/lib/action_view/helpers/asset_url_helper.rb +6 -4
  15. data/lib/action_view/helpers/atom_feed_helper.rb +2 -1
  16. data/lib/action_view/helpers/cache_helper.rb +11 -18
  17. data/lib/action_view/helpers/date_helper.rb +5 -6
  18. data/lib/action_view/helpers/form_helper.rb +61 -19
  19. data/lib/action_view/helpers/form_options_helper.rb +7 -16
  20. data/lib/action_view/helpers/form_tag_helper.rb +9 -7
  21. data/lib/action_view/helpers/javascript_helper.rb +7 -5
  22. data/lib/action_view/helpers/number_helper.rb +9 -8
  23. data/lib/action_view/helpers/rendering_helper.rb +11 -3
  24. data/lib/action_view/helpers/sanitize_helper.rb +2 -2
  25. data/lib/action_view/helpers/tag_helper.rb +94 -19
  26. data/lib/action_view/helpers/tags/base.rb +9 -6
  27. data/lib/action_view/helpers/tags/check_box.rb +0 -1
  28. data/lib/action_view/helpers/tags/collection_check_boxes.rb +0 -1
  29. data/lib/action_view/helpers/tags/collection_helpers.rb +0 -1
  30. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +0 -1
  31. data/lib/action_view/helpers/tags/color_field.rb +0 -1
  32. data/lib/action_view/helpers/tags/date_field.rb +1 -2
  33. data/lib/action_view/helpers/tags/date_select.rb +2 -3
  34. data/lib/action_view/helpers/tags/datetime_field.rb +0 -1
  35. data/lib/action_view/helpers/tags/datetime_local_field.rb +1 -2
  36. data/lib/action_view/helpers/tags/label.rb +4 -1
  37. data/lib/action_view/helpers/tags/month_field.rb +1 -2
  38. data/lib/action_view/helpers/tags/radio_button.rb +0 -1
  39. data/lib/action_view/helpers/tags/select.rb +1 -2
  40. data/lib/action_view/helpers/tags/text_field.rb +0 -1
  41. data/lib/action_view/helpers/tags/time_field.rb +1 -2
  42. data/lib/action_view/helpers/tags/week_field.rb +1 -2
  43. data/lib/action_view/helpers/text_helper.rb +1 -2
  44. data/lib/action_view/helpers/translation_helper.rb +98 -53
  45. data/lib/action_view/helpers/url_helper.rb +107 -13
  46. data/lib/action_view/layouts.rb +3 -5
  47. data/lib/action_view/log_subscriber.rb +26 -11
  48. data/lib/action_view/lookup_context.rb +7 -21
  49. data/lib/action_view/path_set.rb +0 -4
  50. data/lib/action_view/railtie.rb +35 -46
  51. data/lib/action_view/record_identifier.rb +0 -1
  52. data/lib/action_view/renderer/abstract_renderer.rb +92 -14
  53. data/lib/action_view/renderer/collection_renderer.rb +192 -0
  54. data/lib/action_view/renderer/object_renderer.rb +34 -0
  55. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +25 -26
  56. data/lib/action_view/renderer/partial_renderer.rb +20 -283
  57. data/lib/action_view/renderer/renderer.rb +44 -1
  58. data/lib/action_view/renderer/streaming_template_renderer.rb +5 -3
  59. data/lib/action_view/renderer/template_renderer.rb +16 -14
  60. data/lib/action_view/rendering.rb +3 -2
  61. data/lib/action_view/routing_url_for.rb +1 -1
  62. data/lib/action_view/template/error.rb +9 -14
  63. data/lib/action_view/template/handlers/erb/erubi.rb +9 -7
  64. data/lib/action_view/template/handlers/erb.rb +10 -15
  65. data/lib/action_view/template/handlers.rb +0 -26
  66. data/lib/action_view/template/html.rb +1 -11
  67. data/lib/action_view/template/raw_file.rb +0 -3
  68. data/lib/action_view/template/renderable.rb +24 -0
  69. data/lib/action_view/template/resolver.rb +83 -45
  70. data/lib/action_view/template/text.rb +0 -3
  71. data/lib/action_view/template.rb +9 -50
  72. data/lib/action_view/test_case.rb +20 -28
  73. data/lib/action_view/testing/resolvers.rb +10 -32
  74. data/lib/action_view/unbound_template.rb +4 -5
  75. data/lib/action_view/view_paths.rb +34 -37
  76. data/lib/action_view.rb +5 -1
  77. data/lib/assets/compiled/rails-ujs.js +3 -3
  78. metadata +17 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09307c25b4aca33f07c78f0eb2b2e1dcb83316272272340495d9bdb71200b66c'
4
- data.tar.gz: c721b0700848cd657d418b9369ce575abfc12205e764cbdd04aa4f23320b80be
3
+ metadata.gz: 66b9ba4747ae5973f8f784343f64e7201d2bbf8299cb9b9dc2ed7869db55cbc6
4
+ data.tar.gz: da671bc8666ecd9386fa75a7639c837492df9b0d5b81c9f2a66114a522d6dec9
5
5
  SHA512:
6
- metadata.gz: acd68ab05735381289baf92c2895b30dc73b8e25e36ea9b5496104e66d46d630e352785750518404da5c71cade47b8987effe98fcc7e35d6d108dfba51bb2b4f
7
- data.tar.gz: d6e8f0d10ff2d4048c7ad3469584153f6faf284853b7f1afd191dbd3b3b469295855655c5ac59b986c52a894a7c774d11f0a09e747a492ad6d3b0e5edfb0bf27
6
+ metadata.gz: 409ff7a86026884f20e3fbf1eb0560fc990328369c15e90500f27dc8336020edc59acfb3b8da61806c7eac62ae501c1c5f176c4dc7da641f3da338bcfb2cc6f5
7
+ data.tar.gz: 961932d31d4e46c9674a9ea3229db468dfd922c1b79c9f23403b928763f1a8798848dae25554f09255965968109e7557953b4c3a7d6573e142061a3fc3e360c7
data/CHANGELOG.md CHANGED
@@ -1,271 +1,278 @@
1
- ## Rails 6.0.0 (August 16, 2019) ##
1
+ ## Rails 6.1.0 (December 09, 2020) ##
2
2
 
3
- * ActionView::Helpers::SanitizeHelper: support rails-html-sanitizer 1.1.0.
3
+ * SanitizeHelper.sanitized_allowed_attributes and SanitizeHelper.sanitized_allowed_tags
4
+ call safe_list_sanitizer's class method
4
5
 
5
- *Juanito Fatas*
6
+ Fixes #39586
6
7
 
8
+ *Taufiq Muhammadi*
7
9
 
8
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
10
+ * Change form_with to generate non-remote forms by default.
9
11
 
10
- * Fix `select_tag` so that it doesn't change `options` when `include_blank` is present.
12
+ `form_with` would generate a remote form by default. This would confuse
13
+ users because they were forced to handle remote requests.
11
14
 
12
- *Younes SERRAJ*
15
+ All new 6.1 applications will generate non-remote forms by default.
16
+ When upgrading a 6.0 application you can enable remote forms by default by
17
+ setting `config.action_view.form_with_generates_remote_forms` to `true`.
13
18
 
19
+ *Petrik de Heus*
14
20
 
15
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
21
+ * Yield translated strings to calls of `ActionView::FormBuilder#button`
22
+ when a block is given.
16
23
 
17
- * Fix partial caching skips same item issue
24
+ *Sean Doyle*
18
25
 
19
- If we render cached collection partials with repeated items, those repeated items
20
- will get skipped. For example, if you have 5 identical items in your collection, Rails
21
- only renders the first one when `cached` is set to true. But it should render all
22
- 5 items instead.
26
+ * Alias `ActionView::Helpers::Tags::Label::LabelBuilder#translation` to
27
+ `#to_s` so that `form.label` calls can yield that value to their blocks.
23
28
 
24
- Fixes #35114.
29
+ *Sean Doyle*
25
30
 
26
- *Stan Lo*
31
+ * Rename the new `TagHelper#class_names` method to `TagHelper#token_list`,
32
+ and make the original available as an alias.
27
33
 
28
- * Only clear ActionView cache in development on file changes
34
+ token_list("foo", "foo bar")
35
+ # => "foo bar"
29
36
 
30
- To speed up development mode, view caches are only cleared when files in
31
- the view paths have changed. Applications which have implemented custom
32
- `ActionView::Resolver` subclasses may need to add their own cache clearing.
37
+ *Sean Doyle*
33
38
 
34
- *John Hawthorn*
39
+ * ARIA Array and Hash attributes are treated as space separated `DOMTokenList`
40
+ values. This is useful when declaring lists of label text identifiers in
41
+ `aria-labelledby` or `aria-describedby`.
35
42
 
36
- * Fix `ActionView::FixtureResolver` so that it handles template variants correctly.
43
+ tag.input type: 'checkbox', name: 'published', aria: {
44
+ invalid: @post.errors[:published].any?,
45
+ labelledby: ['published_context', 'published_label'],
46
+ describedby: { published_errors: @post.errors[:published].any? }
47
+ }
48
+ #=> <input
49
+ type="checkbox" name="published" aria-invalid="true"
50
+ aria-labelledby="published_context published_label"
51
+ aria-describedby="published_errors"
52
+ >
37
53
 
38
- *Edward Rudd*
54
+ *Sean Doyle*
39
55
 
56
+ * Remove deprecated `escape_whitelist` from `ActionView::Template::Handlers::ERB`.
40
57
 
41
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
58
+ *Rafael Mendonça França*
42
59
 
43
- * Only accept formats from registered mime types
60
+ * Remove deprecated `find_all_anywhere` from `ActionView::Resolver`.
44
61
 
45
- A lack of filtering on mime types could allow an attacker to read
46
- arbitrary files on the target server or to perform a denial of service
47
- attack.
62
+ *Rafael Mendonça França*
48
63
 
49
- Fixes CVE-2019-5418
50
- Fixes CVE-2019-5419
64
+ * Remove deprecated `formats` from `ActionView::Template::HTML`.
51
65
 
52
- *John Hawthorn*, *Eileen M. Uchitelle*, *Aaron Patterson*
66
+ *Rafael Mendonça França*
53
67
 
68
+ * Remove deprecated `formats` from `ActionView::Template::RawFile`.
54
69
 
55
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
70
+ *Rafael Mendonça França*
56
71
 
57
- * `ActionView::Template.finalize_compiled_template_methods` is deprecated with
58
- no replacement.
72
+ * Remove deprecated `formats` from `ActionView::Template::Text`.
59
73
 
60
- *tenderlove*
74
+ *Rafael Mendonça França*
61
75
 
62
- * `config.action_view.finalize_compiled_template_methods` is deprecated with
63
- no replacement.
76
+ * Remove deprecated `find_file` from `ActionView::PathSet`.
64
77
 
65
- *tenderlove*
78
+ *Rafael Mendonça França*
66
79
 
67
- * Ensure unique DOM IDs for collection inputs with float values.
80
+ * Remove deprecated `rendered_format` from `ActionView::LookupContext`.
68
81
 
69
- Fixes #34974.
82
+ *Rafael Mendonça França*
70
83
 
71
- *Mark Edmondson*
84
+ * Remove deprecated `find_file` from `ActionView::ViewPaths`.
72
85
 
86
+ *Rafael Mendonça França*
73
87
 
74
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
88
+ * Require that `ActionView::Base` subclasses implement `#compiled_method_container`.
75
89
 
76
- * [Rename npm package](https://github.com/rails/rails/pull/34905) from
77
- [`rails-ujs`](https://www.npmjs.com/package/rails-ujs) to
78
- [`@rails/ujs`](https://www.npmjs.com/package/@rails/ujs).
90
+ *Rafael Mendonça França*
91
+
92
+ * Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
93
+ in `ActionView::Base#initialize`.
79
94
 
80
- *Javan Makhmali*
95
+ *Rafael Mendonça França*
81
96
 
82
- * Remove deprecated `image_alt` helper.
97
+ * Remove deprecated `format` argument `ActionView::Base#initialize`.
83
98
 
84
99
  *Rafael Mendonça França*
85
100
 
86
- * Fix the need of `#protect_against_forgery?` method defined in
87
- `ActionView::Base` subclasses. This prevents the use of forms and buttons.
101
+ * Remove deprecated `ActionView::Template#refresh`.
88
102
 
89
- *Genadi Samokovarov*
103
+ *Rafael Mendonça França*
90
104
 
91
- * Fix UJS permanently showing disabled text in a[data-remote][data-disable-with] elements within forms.
105
+ * Remove deprecated `ActionView::Template#original_encoding`.
92
106
 
93
- Fixes #33889.
107
+ *Rafael Mendonça França*
94
108
 
95
- *Wolfgang Hobmaier*
109
+ * Remove deprecated `ActionView::Template#variants`.
96
110
 
97
- * Prevent non-primary mouse keys from triggering Rails UJS click handlers.
98
- Firefox fires click events even if the click was triggered by non-primary mouse keys such as right- or scroll-wheel-clicks.
99
- For example, right-clicking a link such as the one described below (with an underlying ajax request registered on click) should not cause that request to occur.
111
+ *Rafael Mendonça França*
100
112
 
101
- ```
102
- <%= link_to 'Remote', remote_path, class: 'remote', remote: true, data: { type: :json } %>
103
- ```
113
+ * Remove deprecated `ActionView::Template#formats`.
104
114
 
105
- Fixes #34541.
115
+ *Rafael Mendonça França*
106
116
 
107
- *Wolfgang Hobmaier*
117
+ * Remove deprecated `ActionView::Template#virtual_path=`.
108
118
 
109
- * Prevent `ActionView::TextHelper#word_wrap` from unexpectedly stripping white space from the _left_ side of lines.
119
+ *Rafael Mendonça França*
110
120
 
111
- For example, given input like this:
121
+ * Remove deprecated `ActionView::Template#updated_at`.
112
122
 
113
- ```
114
- This is a paragraph with an initial indent,
115
- followed by additional lines that are not indented,
116
- and finally terminated with a blockquote:
117
- "A pithy saying"
118
- ```
123
+ *Rafael Mendonça França*
119
124
 
120
- Calling `word_wrap` should not trim the indents on the first and last lines.
125
+ * Remove deprecated `updated_at` argument required on `ActionView::Template#initialize`.
121
126
 
122
- Fixes #34487.
127
+ *Rafael Mendonça França*
123
128
 
124
- *Lyle Mullican*
129
+ * Make `locals` argument required on `ActionView::Template#initialize`.
125
130
 
126
- * Add allocations to template rendering instrumentation.
131
+ *Rafael Mendonça França*
127
132
 
128
- Adds the allocations for template and partial rendering to the server output on render.
133
+ * Remove deprecated `ActionView::Template.finalize_compiled_template_methods`.
129
134
 
130
- ```
131
- Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004)
132
- Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654)
133
- Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564)
134
- ```
135
+ *Rafael Mendonça França*
136
+
137
+ * Remove deprecated `config.action_view.finalize_compiled_template_methods`
138
+
139
+ *Rafael Mendonça França*
140
+
141
+ * Remove deprecated support to calling `ActionView::ViewPaths#with_fallback` with a block.
142
+
143
+ *Rafael Mendonça França*
135
144
 
136
- *Eileen M. Uchitelle*, *Aaron Patterson*
145
+ * Remove deprecated support to passing absolute paths to `render template:`.
137
146
 
138
- * Respect the `only_path` option passed to `url_for` when the options are passed in as an array
147
+ *Rafael Mendonça França*
139
148
 
140
- Fixes #33237.
149
+ * Remove deprecated support to passing relative paths to `render file:`.
141
150
 
142
- *Joel Ambass*
151
+ *Rafael Mendonça França*
143
152
 
144
- * Deprecate calling private model methods from view helpers.
153
+ * Remove support to template handlers that don't accept two arguments.
145
154
 
146
- For example, in methods like `options_from_collection_for_select`
147
- and `collection_select` it is possible to call private methods from
148
- the objects used.
155
+ *Rafael Mendonça França*
149
156
 
150
- Fixes #33546.
157
+ * Remove deprecated pattern argument in `ActionView::Template::PathResolver`.
151
158
 
152
- *Ana María Martínez Gómez*
159
+ *Rafael Mendonça França*
153
160
 
154
- * Fix issue with `button_to`'s `to_form_params`
161
+ * Remove deprecated support to call private methods from object in some view helpers.
155
162
 
156
- `button_to` was throwing exception when invoked with `params` hash that
157
- contains symbol and string keys. The reason for the exception was that
158
- `to_form_params` was comparing the given symbol and string keys.
163
+ *Rafael Mendonça França*
159
164
 
160
- The issue is fixed by turning all keys to strings inside
161
- `to_form_params` before comparing them.
165
+ * `ActionView::Helpers::TranslationHelper#translate` accepts a block, yielding
166
+ the translated text and the fully resolved translation key:
162
167
 
163
- *Georgi Georgiev*
168
+ <%= translate(".relative_key") do |translation, resolved_key| %>
169
+ <span title="<%= resolved_key %>"><%= translation %></span>
170
+ <% end %>
164
171
 
165
- * Mark arrays of translations as trusted safe by using the `_html` suffix.
172
+ *Sean Doyle*
166
173
 
167
- Example:
174
+ * Ensure cache fragment digests include all relevant template dependencies when
175
+ fragments are contained in a block passed to the render helper. Remove the
176
+ virtual_path keyword arguments found in CacheHelper as they no longer possess
177
+ any function following 1581cab.
168
178
 
169
- en:
170
- foo_html:
171
- - "One"
172
- - "<strong>Two</strong>"
173
- - "Three &#128075; &#128578;"
179
+ Fixes #38984.
174
180
 
175
- *Juan Broullon*
181
+ *Aaron Lipman*
176
182
 
177
- * Add `year_format` option to date_select tag. This option makes it possible to customize year
178
- names. Lambda should be passed to use this option.
183
+ * Deprecate `config.action_view.raise_on_missing_translations` in favor of
184
+ `config.i18n.raise_on_missing_translations`.
179
185
 
180
- Example:
186
+ New generalized configuration option now determines whether an error should be raised
187
+ for missing translations in controllers and views.
181
188
 
182
- date_select('user_birthday', '', start_year: 1998, end_year: 2000, year_format: ->year { "Heisei #{year - 1988}" })
189
+ *fatkodima*
183
190
 
184
- The HTML produced:
191
+ * Instrument layout rendering in `TemplateRenderer#render_with_layout` as `render_layout.action_view`,
192
+ and include (when necessary) the layout's virtual path in notification payloads for collection and partial renders.
185
193
 
186
- <select id="user_birthday__1i" name="user_birthday[(1i)]">
187
- <option value="1998">Heisei 10</option>
188
- <option value="1999">Heisei 11</option>
189
- <option value="2000">Heisei 12</option>
190
- </select>
191
- /* The rest is omitted */
194
+ *Zach Kemp*
192
195
 
193
- *Koki Ryu*
196
+ * `ActionView::Base.annotate_rendered_view_with_filenames` annotates HTML output with template file names.
194
197
 
195
- * Fix JavaScript views rendering does not work with Firefox when using
196
- Content Security Policy.
198
+ *Joel Hawksley*, *Aaron Patterson*
197
199
 
198
- Fixes #32577.
200
+ * `ActionView::Helpers::TranslationHelper#translate` returns nil when
201
+ passed `default: nil` without a translation matching `I18n#translate`.
199
202
 
200
- *Yuji Yaginuma*
203
+ *Stefan Wrobel*
201
204
 
202
- * Add the `nonce: true` option for `javascript_include_tag` helper to
203
- support automatic nonce generation for Content Security Policy.
204
- Works the same way as `javascript_tag nonce: true` does.
205
+ * `OptimizedFileSystemResolver` prefers template details in order of locale,
206
+ formats, variants, handlers.
205
207
 
206
- *Yaroslav Markin*
208
+ *Iago Pimenta*
207
209
 
208
- * Remove `ActionView::Helpers::RecordTagHelper`.
210
+ * Added `class_names` helper to create a CSS class value with conditional classes.
209
211
 
210
- *Yoshiyuki Hirano*
212
+ *Joel Hawksley*, *Aaron Patterson*
211
213
 
212
- * Disable `ActionView::Template` finalizers in test environment.
214
+ * Add support for conditional values to TagBuilder.
213
215
 
214
- Template finalization can be expensive in large view test suites.
215
- Add a configuration option,
216
- `action_view.finalize_compiled_template_methods`, and turn it off in
217
- the test environment.
216
+ *Joel Hawksley*
218
217
 
219
- *Simon Coffey*
218
+ * `ActionView::Helpers::FormOptionsHelper#select` should mark option for `nil` as selected.
220
219
 
221
- * Extract the `confirm` call in its own, overridable method in `rails_ujs`.
220
+ ```ruby
221
+ @post = Post.new
222
+ @post.category = nil
222
223
 
223
- Example:
224
+ # Before
225
+ select("post", "category", none: nil, programming: 1, economics: 2)
226
+ # =>
227
+ # <select name="post[category]" id="post_category">
228
+ # <option value="">none</option>
229
+ # <option value="1">programming</option>
230
+ # <option value="2">economics</option>
231
+ # </select>
224
232
 
225
- Rails.confirm = function(message, element) {
226
- return (my_bootstrap_modal_confirm(message));
227
- }
233
+ # After
234
+ select("post", "category", none: nil, programming: 1, economics: 2)
235
+ # =>
236
+ # <select name="post[category]" id="post_category">
237
+ # <option selected="selected" value="">none</option>
238
+ # <option value="1">programming</option>
239
+ # <option value="2">economics</option>
240
+ # </select>
241
+ ```
242
+
243
+ *bogdanvlviv*
228
244
 
229
- *Mathieu Mahé*
245
+ * Log lines for partial renders and started template renders are now
246
+ emitted at the `DEBUG` level instead of `INFO`.
230
247
 
231
- * Enable select tag helper to mark `prompt` option as `selected` and/or `disabled` for `required`
232
- field.
248
+ Completed template renders are still logged at the `INFO` level.
233
249
 
234
- Example:
250
+ *DHH*
235
251
 
236
- select :post,
237
- :category,
238
- ["lifestyle", "programming", "spiritual"],
239
- { selected: "", disabled: "", prompt: "Choose one" },
240
- { required: true }
252
+ * ActionView::Helpers::SanitizeHelper: support rails-html-sanitizer 1.1.0.
241
253
 
242
- Placeholder option would be selected and disabled.
254
+ *Juanito Fatas*
243
255
 
244
- The HTML produced:
256
+ * Added `phone_to` helper method to create a link from mobile numbers.
245
257
 
246
- <select required="required" name="post[category]" id="post_category">
247
- <option disabled="disabled" selected="selected" value="">Choose one</option>
248
- <option value="lifestyle">lifestyle</option>
249
- <option value="programming">programming</option>
250
- <option value="spiritual">spiritual</option></select>
258
+ *Pietro Moro*
251
259
 
252
- *Sergey Prikhodko*
260
+ * annotated_source_code returns an empty array so TemplateErrors without a
261
+ template in the backtrace are surfaced properly by DebugExceptions.
253
262
 
254
- * Don't enforce UTF-8 by default.
263
+ *Guilherme Mansur*, *Kasper Timm Hansen*
255
264
 
256
- With the disabling of TLS 1.0 by most major websites, continuing to run
257
- IE8 or lower becomes increasingly difficult so default to not enforcing
258
- UTF-8 encoding as it's not relevant to other browsers.
265
+ * Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
259
266
 
260
- *Andrew White*
267
+ *Guilherme Mansur*, *Gannon McGibbon*
261
268
 
262
- * Change translation key of `submit_tag` from `module_name_class_name` to `module_name/class_name`.
269
+ * `RenderingHelper` supports rendering objects that `respond_to?` `:render_in`.
263
270
 
264
- *Rui Onodera*
271
+ *Joel Hawksley*, *Natasha Umer*, *Aaron Patterson*, *Shawn Allen*, *Emily Plummer*, *Diana Mounter*, *John Hawthorn*, *Nathan Herald*, *Zaid Zawaideh*, *Zach Ahn*
265
272
 
266
- * Rails 6 requires Ruby 2.5.0 or newer.
273
+ * Fix `select_tag` so that it doesn't change `options` when `include_blank` is present.
267
274
 
268
- *Jeremy Daer*, *Kasper Timm Hansen*
275
+ *Younes SERRAJ*
269
276
 
270
277
 
271
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actionview/CHANGELOG.md) for previous changes.
278
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionview/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2019 David Heinemeier Hansson
1
+ Copyright (c) 2004-2020 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -37,4 +37,4 @@ Bug reports for the Ruby on Rails project can be filed here:
37
37
 
38
38
  Feature requests should be discussed on the rails-core mailing list here:
39
39
 
40
- * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
40
+ * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -3,7 +3,6 @@
3
3
  require "active_support/core_ext/module/attr_internal"
4
4
  require "active_support/core_ext/module/attribute_accessors"
5
5
  require "active_support/ordered_options"
6
- require "active_support/deprecation"
7
6
  require "action_view/log_subscriber"
8
7
  require "action_view/helpers"
9
8
  require "action_view/context"
@@ -28,7 +27,7 @@ module ActionView #:nodoc:
28
27
  # Name: <%= person.name %><br/>
29
28
  # <% end %>
30
29
  #
31
- # The loop is setup in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
30
+ # The loop is set up in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
32
31
  # is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
33
32
  #
34
33
  # <%# WRONG %>
@@ -152,7 +151,7 @@ module ActionView #:nodoc:
152
151
  # Specify whether rendering within namespaced controllers should prefix
153
152
  # the partial paths for ActiveModel objects with the namespace.
154
153
  # (e.g., an Admin::PostsController would render @post using /admin/posts/_post.erb)
155
- cattr_accessor :prefix_partial_path_with_controller_namespace, default: true
154
+ class_attribute :prefix_partial_path_with_controller_namespace, default: true
156
155
 
157
156
  # Specify default_formats that can be rendered.
158
157
  cattr_accessor :default_formats
@@ -163,6 +162,9 @@ module ActionView #:nodoc:
163
162
  # Specify whether submit_tag should automatically disable on click
164
163
  cattr_accessor :automatically_disable_submit_tag, default: true
165
164
 
165
+ # Annotate rendered view with file names
166
+ cattr_accessor :annotate_rendered_view_with_filenames, default: false
167
+
166
168
  class_attribute :_routes
167
169
  class_attribute :logger
168
170
 
@@ -188,6 +190,10 @@ module ActionView #:nodoc:
188
190
  # correctly.
189
191
  define_method(:compiled_method_container) { subclass }
190
192
  define_singleton_method(:compiled_method_container) { subclass }
193
+
194
+ def inspect
195
+ "#<ActionView::Base:#{'%#016x' % (object_id << 1)}>"
196
+ end
191
197
  }
192
198
  end
193
199
 
@@ -207,21 +213,6 @@ module ActionView #:nodoc:
207
213
 
208
214
  # :stopdoc:
209
215
 
210
- def self.build_lookup_context(context)
211
- case context
212
- when ActionView::Renderer
213
- context.lookup_context
214
- when Array
215
- ActionView::LookupContext.new(context)
216
- when ActionView::PathSet
217
- ActionView::LookupContext.new(context)
218
- when nil
219
- ActionView::LookupContext.new([])
220
- else
221
- raise NotImplementedError, context.class.name
222
- end
223
- end
224
-
225
216
  def self.empty
226
217
  with_view_paths([])
227
218
  end
@@ -234,58 +225,36 @@ module ActionView #:nodoc:
234
225
  new context, assigns, controller
235
226
  end
236
227
 
237
- NULL = Object.new
238
-
239
228
  # :startdoc:
240
229
 
241
- def initialize(lookup_context = nil, assigns = {}, controller = nil, formats = NULL) #:nodoc:
230
+ def initialize(lookup_context, assigns, controller) #:nodoc:
242
231
  @_config = ActiveSupport::InheritableOptions.new
243
232
 
244
- unless formats == NULL
245
- ActiveSupport::Deprecation.warn <<~eowarn.squish
246
- Passing formats to ActionView::Base.new is deprecated
247
- eowarn
248
- end
249
-
250
- case lookup_context
251
- when ActionView::LookupContext
252
- @lookup_context = lookup_context
253
- else
254
- ActiveSupport::Deprecation.warn <<~eowarn.squish
255
- ActionView::Base instances should be constructed with a lookup context,
256
- assignments, and a controller.
257
- eowarn
258
- @lookup_context = self.class.build_lookup_context(lookup_context)
259
- end
233
+ @lookup_context = lookup_context
260
234
 
261
235
  @view_renderer = ActionView::Renderer.new @lookup_context
262
236
  @current_template = nil
263
237
 
264
- @cache_hit = {}
265
238
  assign(assigns)
266
239
  assign_controller(controller)
267
240
  _prepare_context
268
241
  end
269
242
 
270
- def _run(method, template, locals, buffer, &block)
271
- _old_output_buffer, _old_virtual_path, _old_template = @output_buffer, @virtual_path, @current_template
272
- @current_template = template
243
+ def _run(method, template, locals, buffer, add_to_stack: true, &block)
244
+ _old_output_buffer, _old_template = @output_buffer, @current_template
245
+ @current_template = template if add_to_stack
273
246
  @output_buffer = buffer
274
- send(method, locals, buffer, &block)
247
+ public_send(method, locals, buffer, &block)
275
248
  ensure
276
- @output_buffer, @virtual_path, @current_template = _old_output_buffer, _old_virtual_path, _old_template
249
+ @output_buffer, @current_template = _old_output_buffer, _old_template
277
250
  end
278
251
 
279
252
  def compiled_method_container
280
- if self.class == ActionView::Base
281
- ActiveSupport::Deprecation.warn <<~eowarn.squish
282
- ActionView::Base instances must implement `compiled_method_container`
283
- or use the class method `with_empty_template_cache` for constructing
284
- an ActionView::Base instances that has an empty cache.
285
- eowarn
286
- end
287
-
288
- self.class
253
+ raise NotImplementedError, <<~msg.squish
254
+ Subclasses of ActionView::Base must implement `compiled_method_container`
255
+ or use the class method `with_empty_template_cache` for constructing
256
+ an ActionView::Base subclass that has an empty cache.
257
+ msg
289
258
  end
290
259
 
291
260
  def in_rendering_context(options)
@@ -41,10 +41,8 @@ module ActionView
41
41
  end
42
42
 
43
43
  private
44
-
45
44
  def dirs_to_watch
46
- fs_paths = all_view_paths.grep(FileSystemResolver)
47
- fs_paths.map(&:path).sort.uniq
45
+ all_view_paths.grep(FileSystemResolver).map!(&:path).tap(&:uniq!).sort!
48
46
  end
49
47
 
50
48
  def all_view_paths
@@ -18,7 +18,6 @@ module ActionView
18
18
  def _prepare_context
19
19
  @view_flow = OutputFlow.new
20
20
  @output_buffer = nil
21
- @virtual_path = nil
22
21
  end
23
22
 
24
23
  # Encapsulates the interaction with the view flow so it