actionpack 7.2.3.1 → 8.0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +199 -120
- data/lib/abstract_controller/rendering.rb +0 -1
- data/lib/action_controller/base.rb +1 -1
- data/lib/action_controller/form_builder.rb +3 -3
- data/lib/action_controller/metal/allow_browser.rb +11 -1
- data/lib/action_controller/metal/conditional_get.rb +5 -1
- data/lib/action_controller/metal/data_streaming.rb +4 -2
- data/lib/action_controller/metal/instrumentation.rb +1 -2
- data/lib/action_controller/metal/live.rb +58 -10
- data/lib/action_controller/metal/rate_limiting.rb +13 -4
- data/lib/action_controller/metal/renderers.rb +2 -3
- data/lib/action_controller/metal/streaming.rb +5 -84
- data/lib/action_controller/metal/strong_parameters.rb +277 -89
- data/lib/action_controller/railtie.rb +6 -7
- data/lib/action_controller/test_case.rb +12 -2
- data/lib/action_dispatch/http/cache.rb +27 -10
- data/lib/action_dispatch/http/content_security_policy.rb +14 -1
- data/lib/action_dispatch/http/param_builder.rb +186 -0
- data/lib/action_dispatch/http/param_error.rb +26 -0
- data/lib/action_dispatch/http/permissions_policy.rb +2 -0
- data/lib/action_dispatch/http/query_parser.rb +53 -0
- data/lib/action_dispatch/http/request.rb +60 -16
- data/lib/action_dispatch/http/response.rb +34 -13
- data/lib/action_dispatch/journey/parser.rb +99 -196
- data/lib/action_dispatch/journey/scanner.rb +44 -42
- data/lib/action_dispatch/middleware/cookies.rb +4 -2
- data/lib/action_dispatch/middleware/debug_exceptions.rb +17 -4
- data/lib/action_dispatch/middleware/debug_view.rb +0 -5
- data/lib/action_dispatch/middleware/exception_wrapper.rb +0 -6
- data/lib/action_dispatch/middleware/request_id.rb +2 -1
- data/lib/action_dispatch/middleware/ssl.rb +13 -3
- data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +0 -3
- data/lib/action_dispatch/railtie.rb +8 -0
- data/lib/action_dispatch/request/session.rb +1 -0
- data/lib/action_dispatch/request/utils.rb +9 -3
- data/lib/action_dispatch/routing/inspector.rb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +91 -62
- data/lib/action_dispatch/routing/polymorphic_routes.rb +2 -2
- data/lib/action_dispatch/routing/route_set.rb +21 -10
- data/lib/action_dispatch/routing/routes_proxy.rb +1 -0
- data/lib/action_dispatch/system_testing/browser.rb +12 -21
- data/lib/action_dispatch/testing/assertions/response.rb +12 -2
- data/lib/action_dispatch/testing/assertions/routing.rb +16 -12
- data/lib/action_dispatch/testing/integration.rb +18 -7
- data/lib/action_dispatch.rb +6 -4
- data/lib/action_pack/gem_version.rb +3 -3
- metadata +15 -48
- data/lib/action_dispatch/journey/parser.y +0 -50
- data/lib/action_dispatch/journey/parser_extras.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4cafacead9b35453fc666d10a2485209e2b271f584b2b30aff8cc232ed99a92
|
|
4
|
+
data.tar.gz: 70fd43dc74a864660b401e580067fd5d0dfdb2fb56b446a10080dabd8a868903
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9078e1c90c3e45687f8c1e0b815798259d414679c574eb6522e8bebda8faab18709642e29cf5a688e2601451804b116fab8039ee10bc27b2d46ff56a4ad45a5a
|
|
7
|
+
data.tar.gz: 96fb1152a53e8f172772f0d1be0fab5feb9a511a80d421f6a0c693a8628d157426dcf0152fefefc9f091b6bd3199fb9e4571d4e13fede9da7a9e30eaf17f7966
|
data/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,59 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.5.1 (July 29, 2026) ##
|
|
2
2
|
|
|
3
3
|
* No changes.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
## Rails
|
|
6
|
+
## Rails 8.0.5 (March 24, 2026) ##
|
|
7
|
+
|
|
8
|
+
* Add `config.action_controller.live_streaming_excluded_keys` to control execution state sharing in ActionController::Live.
|
|
9
|
+
|
|
10
|
+
When using ActionController::Live, actions are executed in a separate thread that shares
|
|
11
|
+
state from the parent thread. This new configuration allows applications to opt-out specific
|
|
12
|
+
state keys that should not be shared.
|
|
13
|
+
|
|
14
|
+
This is useful when streaming inside a `connected_to` block, where you may want
|
|
15
|
+
the streaming thread to use its own database connection context.
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# config/application.rb
|
|
19
|
+
config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
By default, all keys are shared.
|
|
23
|
+
|
|
24
|
+
*Eileen M. Uchitelle*
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Rails 8.0.4.1 (March 23, 2026) ##
|
|
28
|
+
|
|
29
|
+
* No changes.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Rails 8.0.4 (October 28, 2025) ##
|
|
7
33
|
|
|
8
34
|
* Submit test requests using `as: :html` with `Content-Type: x-www-form-urlencoded`
|
|
9
35
|
|
|
10
36
|
*Sean Doyle*
|
|
11
37
|
|
|
38
|
+
|
|
39
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
40
|
+
|
|
41
|
+
* URL helpers for engines mounted at the application root handle `SCRIPT_NAME` correctly.
|
|
42
|
+
|
|
43
|
+
Fixed an issue where `SCRIPT_NAME` is not applied to paths generated for routes in an engine
|
|
44
|
+
mounted at "/".
|
|
45
|
+
|
|
46
|
+
*Mike Dalessio*
|
|
47
|
+
|
|
48
|
+
* Fix `Rails.application.reload_routes!` from clearing almost all routes.
|
|
49
|
+
|
|
50
|
+
When calling `Rails.application.reload_routes!` inside a middleware of
|
|
51
|
+
a Rake task, it was possible under certain conditions that all routes would be cleared.
|
|
52
|
+
If ran inside a middleware, this would result in getting a 404 on most page you visit.
|
|
53
|
+
This issue was only happening in development.
|
|
54
|
+
|
|
55
|
+
*Edouard Chin*
|
|
56
|
+
|
|
12
57
|
* Address `rack 3.2` deprecations warnings.
|
|
13
58
|
|
|
14
59
|
```
|
|
@@ -16,10 +61,14 @@
|
|
|
16
61
|
Please use :unprocessable_content instead.
|
|
17
62
|
```
|
|
18
63
|
|
|
19
|
-
Rails API will transparently convert one into the other for the
|
|
64
|
+
Rails API will transparently convert one into the other for the foreseeable future.
|
|
20
65
|
|
|
21
66
|
*Earlopain*, *Jean Boussier*
|
|
22
67
|
|
|
68
|
+
* Support hash-source in Content Security Policy.
|
|
69
|
+
|
|
70
|
+
*madogiwa*
|
|
71
|
+
|
|
23
72
|
* Always return empty body for HEAD requests in `PublicExceptions` and
|
|
24
73
|
`DebugExceptions`.
|
|
25
74
|
|
|
@@ -27,218 +76,248 @@
|
|
|
27
76
|
|
|
28
77
|
*Hartley McGuire*
|
|
29
78
|
|
|
30
|
-
* Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
|
|
31
|
-
|
|
32
|
-
Prevents various security scanners from causing exceptions.
|
|
33
79
|
|
|
34
|
-
|
|
80
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
35
81
|
|
|
36
|
-
*
|
|
82
|
+
* No changes.
|
|
37
83
|
|
|
38
|
-
|
|
84
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
39
85
|
|
|
40
|
-
*
|
|
86
|
+
* Improve `with_routing` test helper to not rebuild the middleware stack.
|
|
41
87
|
|
|
42
|
-
|
|
88
|
+
Otherwise some middleware configuration could be lost.
|
|
43
89
|
|
|
44
|
-
*
|
|
90
|
+
*Édouard Chin*
|
|
45
91
|
|
|
46
|
-
|
|
92
|
+
* Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
|
|
47
93
|
|
|
94
|
+
This makes it easier to locate the source of the problem, especially for routes drawn by gems.
|
|
48
95
|
|
|
49
|
-
|
|
96
|
+
Before:
|
|
97
|
+
```
|
|
98
|
+
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
99
|
+
```
|
|
50
100
|
|
|
51
|
-
|
|
101
|
+
After:
|
|
102
|
+
```
|
|
103
|
+
Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
104
|
+
```
|
|
52
105
|
|
|
106
|
+
*Jeremy Green*
|
|
53
107
|
|
|
54
|
-
|
|
108
|
+
* Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
|
|
55
109
|
|
|
56
|
-
|
|
57
|
-
Developers should use multiple arguments, and different directive methods instead.
|
|
110
|
+
Prevents various security scanners from causing exceptions.
|
|
58
111
|
|
|
59
|
-
|
|
112
|
+
*Martin Emde*
|
|
60
113
|
|
|
61
|
-
|
|
114
|
+
* Fix `ActionDispatch::Executor` to unwrap exceptions like other error reporting middlewares.
|
|
62
115
|
|
|
116
|
+
*Jean Boussier*
|
|
63
117
|
|
|
64
|
-
## Rails 7.2.2 (October 30, 2024) ##
|
|
65
118
|
|
|
66
|
-
|
|
119
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
67
120
|
|
|
68
|
-
|
|
121
|
+
* Add `ActionDispatch::Request::Session#store` method to conform Rack spec.
|
|
69
122
|
|
|
123
|
+
*Yaroslav*
|
|
70
124
|
|
|
71
|
-
## Rails 7.2.1.2 (October 23, 2024) ##
|
|
72
125
|
|
|
73
|
-
|
|
126
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
74
127
|
|
|
128
|
+
* Add validation to content security policies to disallow spaces and semicolons.
|
|
129
|
+
Developers should use multiple arguments, and different directive methods instead.
|
|
75
130
|
|
|
76
|
-
|
|
131
|
+
[CVE-2024-54133]
|
|
77
132
|
|
|
78
|
-
*
|
|
133
|
+
*Gannon McGibbon*
|
|
79
134
|
|
|
80
|
-
[CVE-2024-47887]
|
|
81
135
|
|
|
82
|
-
|
|
136
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
83
137
|
|
|
84
|
-
*
|
|
138
|
+
* No changes.
|
|
85
139
|
|
|
86
|
-
[CVE-2024-41128]
|
|
87
140
|
|
|
88
|
-
|
|
141
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
89
142
|
|
|
143
|
+
* Fix routes with `::` in the path.
|
|
90
144
|
|
|
91
|
-
|
|
145
|
+
*Rafael Mendonça França*
|
|
92
146
|
|
|
93
|
-
*
|
|
147
|
+
* Maintain Rack 2 parameter parsing behaviour.
|
|
94
148
|
|
|
95
|
-
*
|
|
149
|
+
*Matthew Draper*
|
|
96
150
|
|
|
97
151
|
|
|
98
|
-
## Rails
|
|
152
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
99
153
|
|
|
100
|
-
*
|
|
154
|
+
* Remove `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
|
|
101
155
|
|
|
102
|
-
*
|
|
156
|
+
*Rafael Mendonça França*
|
|
103
157
|
|
|
104
|
-
*
|
|
105
|
-
[CVE-2024-28103]
|
|
158
|
+
* Improve `ActionController::TestCase` to expose a binary encoded `request.body`.
|
|
106
159
|
|
|
107
|
-
|
|
160
|
+
The rack spec clearly states:
|
|
108
161
|
|
|
109
|
-
|
|
162
|
+
> The input stream is an IO-like object which contains the raw HTTP POST data.
|
|
163
|
+
> When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode.
|
|
110
164
|
|
|
111
|
-
|
|
165
|
+
Until now its encoding was generally UTF-8, which doesn't accurately reflect production
|
|
166
|
+
behavior.
|
|
112
167
|
|
|
113
|
-
*
|
|
114
|
-
suggested correct location for the missing template.
|
|
168
|
+
*Jean Boussier*
|
|
115
169
|
|
|
116
|
-
|
|
170
|
+
* Update `ActionController::AllowBrowser` to support passing method names to `:block`
|
|
117
171
|
|
|
118
|
-
|
|
172
|
+
```ruby
|
|
173
|
+
class ApplicationController < ActionController::Base
|
|
174
|
+
allow_browser versions: :modern, block: :handle_outdated_browser
|
|
119
175
|
|
|
120
|
-
|
|
121
|
-
|
|
176
|
+
private
|
|
177
|
+
def handle_outdated_browser
|
|
178
|
+
render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
```
|
|
122
182
|
|
|
123
|
-
*
|
|
183
|
+
*Sean Doyle*
|
|
124
184
|
|
|
125
|
-
*
|
|
185
|
+
* Raise an `ArgumentError` when invalid `:only` or `:except` options are passed into `#resource` and `#resources`.
|
|
126
186
|
|
|
127
|
-
|
|
128
|
-
Rails.application.routes.draw do
|
|
129
|
-
controller :home do
|
|
130
|
-
get "recent", to: "recent_posts"
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
```
|
|
187
|
+
*Joshua Young*
|
|
134
188
|
|
|
135
|
-
|
|
189
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
136
190
|
|
|
137
|
-
*
|
|
191
|
+
* Fix non-GET requests not updating cookies in `ActionController::TestCase`.
|
|
138
192
|
|
|
139
|
-
*
|
|
193
|
+
*Jon Moss*, *Hartley McGuire*
|
|
140
194
|
|
|
141
|
-
*
|
|
195
|
+
* Update `ActionController::Live` to use a thread-pool to reuse threads across requests.
|
|
142
196
|
|
|
143
|
-
*
|
|
197
|
+
*Adam Renberg Tamm*
|
|
144
198
|
|
|
145
|
-
*
|
|
199
|
+
* Introduce safer, more explicit params handling method with `params#expect` such that
|
|
200
|
+
`params.expect(table: [ :attr ])` replaces `params.require(:table).permit(:attr)`
|
|
146
201
|
|
|
147
|
-
|
|
202
|
+
Ensures params are filtered with consideration for the expected
|
|
203
|
+
types of values, improving handling of params and avoiding ignorable
|
|
204
|
+
errors caused by params tampering.
|
|
148
205
|
|
|
149
206
|
```ruby
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
207
|
+
# If the url is altered to ?person=hacked
|
|
208
|
+
# Before
|
|
209
|
+
params.require(:person).permit(:name, :age, pets: [:name])
|
|
210
|
+
# raises NoMethodError, causing a 500 and potential error reporting
|
|
211
|
+
|
|
212
|
+
# After
|
|
213
|
+
params.expect(person: [ :name, :age, pets: [[:name]] ])
|
|
214
|
+
# raises ActionController::ParameterMissing, correctly returning a 400 error
|
|
215
|
+
```
|
|
154
216
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
217
|
+
You may also notice the new double array `[[:name]]`. In order to
|
|
218
|
+
declare when a param is expected to be an array of parameter hashes,
|
|
219
|
+
this new double array syntax is used to explicitly declare an array.
|
|
220
|
+
`expect` requires you to declare expected arrays in this way, and will
|
|
221
|
+
ignore arrays that are passed when, for example, `pet: [:name]` is used.
|
|
159
222
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
end
|
|
164
|
-
```
|
|
223
|
+
In order to preserve compatibility, `permit` does not adopt the new
|
|
224
|
+
double array syntax and is therefore more permissive about unexpected
|
|
225
|
+
types. Using `expect` everywhere is recommended.
|
|
165
226
|
|
|
166
|
-
|
|
227
|
+
We suggest replacing `params.require(:person).permit(:name, :age)`
|
|
228
|
+
with the direct replacement `params.expect(person: [:name, :age])`
|
|
229
|
+
to prevent external users from manipulating params to trigger 500
|
|
230
|
+
errors. A 400 error will be returned instead, using public/400.html
|
|
167
231
|
|
|
168
|
-
|
|
232
|
+
Usage of `params.require(:id)` should likewise be replaced with
|
|
233
|
+
`params.expect(:id)` which is designed to ensure that `params[:id]`
|
|
234
|
+
is a scalar and not an array or hash, also requiring the param.
|
|
169
235
|
|
|
170
236
|
```ruby
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
end
|
|
237
|
+
# Before
|
|
238
|
+
User.find(params.require(:id)) # allows an array, altering behavior
|
|
174
239
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
|
|
178
|
-
end
|
|
240
|
+
# After
|
|
241
|
+
User.find(params.expect(:id)) # expect only returns non-blank permitted scalars (excludes Hash, Array, nil, "", etc)
|
|
179
242
|
```
|
|
180
243
|
|
|
181
|
-
*
|
|
244
|
+
*Martin Emde*
|
|
182
245
|
|
|
183
|
-
*
|
|
246
|
+
* System Testing: Disable Chrome's search engine choice by default in system tests.
|
|
184
247
|
|
|
185
|
-
*
|
|
248
|
+
*glaszig*
|
|
186
249
|
|
|
187
|
-
*
|
|
250
|
+
* Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
|
|
188
251
|
|
|
189
|
-
|
|
252
|
+
*Hartley McGuire*
|
|
190
253
|
|
|
191
|
-
|
|
254
|
+
* Remove `racc` dependency by manually writing `ActionDispatch::Journey::Scanner`.
|
|
192
255
|
|
|
193
|
-
*
|
|
256
|
+
*Gannon McGibbon*
|
|
257
|
+
|
|
258
|
+
* Speed up `ActionDispatch::Routing::Mapper::Scope#[]` by merging frame hashes.
|
|
194
259
|
|
|
195
260
|
*Gannon McGibbon*
|
|
196
261
|
|
|
197
|
-
*
|
|
262
|
+
* Allow bots to ignore `allow_browser`.
|
|
198
263
|
|
|
199
|
-
*
|
|
264
|
+
*Matthew Nguyen*
|
|
200
265
|
|
|
201
|
-
*
|
|
266
|
+
* Deprecate drawing routes with multiple paths to make routing faster.
|
|
267
|
+
You may use `with_options` or a loop to make drawing multiple paths easier.
|
|
202
268
|
|
|
203
|
-
|
|
269
|
+
```ruby
|
|
270
|
+
# Before
|
|
271
|
+
get "/users", "/other_path", to: "users#index"
|
|
204
272
|
|
|
205
|
-
|
|
273
|
+
# After
|
|
274
|
+
get "/users", to: "users#index"
|
|
275
|
+
get "/other_path", to: "users#index"
|
|
276
|
+
```
|
|
206
277
|
|
|
207
|
-
*
|
|
278
|
+
*Gannon McGibbon*
|
|
208
279
|
|
|
209
|
-
*
|
|
280
|
+
* Make `http_cache_forever` use `immutable: true`
|
|
210
281
|
|
|
211
|
-
*
|
|
282
|
+
*Nate Matykiewicz*
|
|
212
283
|
|
|
213
|
-
*
|
|
284
|
+
* Add `config.action_dispatch.strict_freshness`.
|
|
214
285
|
|
|
215
|
-
|
|
286
|
+
When set to `true`, the `ETag` header takes precedence over the `Last-Modified` header when both are present,
|
|
287
|
+
as specified by RFC 7232, Section 6.
|
|
216
288
|
|
|
217
|
-
|
|
289
|
+
Defaults to `false` to maintain compatibility with previous versions of Rails, but is enabled as part of
|
|
290
|
+
Rails 8.0 defaults.
|
|
218
291
|
|
|
219
|
-
*
|
|
292
|
+
*heka1024*
|
|
220
293
|
|
|
221
|
-
*
|
|
222
|
-
error with parallel system tests.
|
|
294
|
+
* Support `immutable` directive in Cache-Control
|
|
223
295
|
|
|
224
|
-
|
|
296
|
+
```ruby
|
|
297
|
+
expires_in 1.minute, public: true, immutable: true
|
|
298
|
+
# Cache-Control: public, max-age=60, immutable
|
|
299
|
+
```
|
|
225
300
|
|
|
226
|
-
*
|
|
301
|
+
*heka1024*
|
|
227
302
|
|
|
228
|
-
|
|
229
|
-
* Remove deprecated constant `ActionDispatch::IllegalStateError`.
|
|
303
|
+
* Add `:wasm_unsafe_eval` mapping for `content_security_policy`
|
|
230
304
|
|
|
231
|
-
|
|
305
|
+
```ruby
|
|
306
|
+
# Before
|
|
307
|
+
policy.script_src "'wasm-unsafe-eval'"
|
|
308
|
+
|
|
309
|
+
# After
|
|
310
|
+
policy.script_src :wasm_unsafe_eval
|
|
311
|
+
```
|
|
232
312
|
|
|
233
|
-
*
|
|
313
|
+
*Joe Haig*
|
|
234
314
|
|
|
235
|
-
|
|
236
|
-
The result would be like this:
|
|
315
|
+
* Add `display_capture` and `keyboard_map` in `permissions_policy`
|
|
237
316
|
|
|
238
|
-
|
|
317
|
+
*Cyril Blaecke*
|
|
239
318
|
|
|
240
|
-
|
|
319
|
+
* Add `connect` route helper.
|
|
241
320
|
|
|
242
|
-
*
|
|
321
|
+
*Samuel Williams*
|
|
243
322
|
|
|
244
|
-
Please check [7-
|
|
323
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionpack/CHANGELOG.md) for previous changes.
|
|
@@ -266,7 +266,7 @@ module ActionController
|
|
|
266
266
|
ParamsWrapper
|
|
267
267
|
]
|
|
268
268
|
|
|
269
|
-
# Note: Documenting these severely
|
|
269
|
+
# Note: Documenting these severely degrades the performance of rdoc
|
|
270
270
|
# :stopdoc:
|
|
271
271
|
include AbstractController::Rendering
|
|
272
272
|
include AbstractController::Translation
|
|
@@ -22,10 +22,10 @@ module ActionController
|
|
|
22
22
|
# default_form_builder AdminFormBuilder
|
|
23
23
|
# end
|
|
24
24
|
#
|
|
25
|
-
# Then in the view any form using `form_for` will be an
|
|
26
|
-
# specified form builder:
|
|
25
|
+
# Then in the view any form using `form_with` or `form_for` will be an
|
|
26
|
+
# instance of the specified form builder:
|
|
27
27
|
#
|
|
28
|
-
# <%=
|
|
28
|
+
# <%= form_with(model: @instance) do |builder| %>
|
|
29
29
|
# <%= builder.special_field(:name) %>
|
|
30
30
|
# <% end %>
|
|
31
31
|
module FormBuilder
|
|
@@ -36,6 +36,16 @@ module ActionController # :nodoc:
|
|
|
36
36
|
# end
|
|
37
37
|
#
|
|
38
38
|
# class ApplicationController < ActionController::Base
|
|
39
|
+
# # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has
|
|
40
|
+
# allow_browser versions: :modern, block: :handle_outdated_browser
|
|
41
|
+
#
|
|
42
|
+
# private
|
|
43
|
+
# def handle_outdated_browser
|
|
44
|
+
# render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable
|
|
45
|
+
# end
|
|
46
|
+
# end
|
|
47
|
+
#
|
|
48
|
+
# class ApplicationController < ActionController::Base
|
|
39
49
|
# # All versions of Chrome and Opera will be allowed, but no versions of "internet explorer" (ie). Safari needs to be 16.4+ and Firefox 121+.
|
|
40
50
|
# allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
|
|
41
51
|
# end
|
|
@@ -55,7 +65,7 @@ module ActionController # :nodoc:
|
|
|
55
65
|
|
|
56
66
|
if BrowserBlocker.new(request, versions: versions).blocked?
|
|
57
67
|
ActiveSupport::Notifications.instrument("browser_block.action_controller", request: request, versions: versions) do
|
|
58
|
-
instance_exec(&block)
|
|
68
|
+
block.is_a?(Symbol) ? send(block) : instance_exec(&block)
|
|
59
69
|
end
|
|
60
70
|
end
|
|
61
71
|
end
|
|
@@ -259,6 +259,9 @@ module ActionController
|
|
|
259
259
|
# `:stale_if_error`
|
|
260
260
|
# : Sets the value of the `stale-if-error` directive.
|
|
261
261
|
#
|
|
262
|
+
# `:immutable`
|
|
263
|
+
# : If true, adds the `immutable` directive.
|
|
264
|
+
#
|
|
262
265
|
#
|
|
263
266
|
# Any additional key-value pairs are concatenated as directives. For a list of
|
|
264
267
|
# supported `Cache-Control` directives, see the [article on
|
|
@@ -292,6 +295,7 @@ module ActionController
|
|
|
292
295
|
must_revalidate: options.delete(:must_revalidate),
|
|
293
296
|
stale_while_revalidate: options.delete(:stale_while_revalidate),
|
|
294
297
|
stale_if_error: options.delete(:stale_if_error),
|
|
298
|
+
immutable: options.delete(:immutable),
|
|
295
299
|
)
|
|
296
300
|
options.delete(:private)
|
|
297
301
|
|
|
@@ -315,7 +319,7 @@ module ActionController
|
|
|
315
319
|
# user's web browser. To allow proxies to cache the response, set `true` to
|
|
316
320
|
# indicate that they can serve the cached response to all users.
|
|
317
321
|
def http_cache_forever(public: false)
|
|
318
|
-
expires_in 100.years, public: public
|
|
322
|
+
expires_in 100.years, public: public, immutable: true
|
|
319
323
|
|
|
320
324
|
yield if stale?(etag: request.fullpath,
|
|
321
325
|
last_modified: Time.new(2011, 1, 1).utc,
|
|
@@ -28,7 +28,8 @@ module ActionController # :nodoc:
|
|
|
28
28
|
# `send_file(params[:path])` allows a malicious user to download any file on
|
|
29
29
|
# your server.
|
|
30
30
|
#
|
|
31
|
-
# Options:
|
|
31
|
+
# #### Options:
|
|
32
|
+
#
|
|
32
33
|
# * `:filename` - suggests a filename for the browser to use. Defaults to
|
|
33
34
|
# `File.basename(path)`.
|
|
34
35
|
# * `:type` - specifies an HTTP content type. You can specify either a string
|
|
@@ -90,7 +91,8 @@ module ActionController # :nodoc:
|
|
|
90
91
|
# inline data. You may also set the content type, the file name, and other
|
|
91
92
|
# things.
|
|
92
93
|
#
|
|
93
|
-
# Options:
|
|
94
|
+
# #### Options:
|
|
95
|
+
#
|
|
94
96
|
# * `:filename` - suggests a filename for the browser to use.
|
|
95
97
|
# * `:type` - specifies an HTTP content type. Defaults to
|
|
96
98
|
# `application/octet-stream`. You can specify either a string or a symbol
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# :markup: markdown
|
|
4
4
|
|
|
5
|
-
require "benchmark"
|
|
6
5
|
require "abstract_controller/logger"
|
|
7
6
|
|
|
8
7
|
module ActionController
|
|
@@ -29,7 +28,7 @@ module ActionController
|
|
|
29
28
|
def render(*)
|
|
30
29
|
render_output = nil
|
|
31
30
|
self.view_runtime = cleanup_view_runtime do
|
|
32
|
-
Benchmark.
|
|
31
|
+
ActiveSupport::Benchmark.realtime(:float_millisecond) { render_output = super }
|
|
33
32
|
end
|
|
34
33
|
render_output
|
|
35
34
|
end
|