actionpack 7.2.2.1 → 8.0.5
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 +228 -101
- data/README.rdoc +1 -1
- data/lib/abstract_controller/base.rb +1 -12
- data/lib/abstract_controller/collector.rb +1 -1
- data/lib/abstract_controller/helpers.rb +1 -1
- 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 +59 -11
- data/lib/action_controller/metal/params_wrapper.rb +3 -3
- data/lib/action_controller/metal/rate_limiting.rb +13 -4
- data/lib/action_controller/metal/redirecting.rb +4 -3
- data/lib/action_controller/metal/renderers.rb +2 -3
- data/lib/action_controller/metal/rendering.rb +1 -1
- data/lib/action_controller/metal/request_forgery_protection.rb +3 -1
- data/lib/action_controller/metal/streaming.rb +5 -84
- data/lib/action_controller/metal/strong_parameters.rb +277 -92
- data/lib/action_controller/railtie.rb +6 -7
- data/lib/action_controller/renderer.rb +0 -1
- data/lib/action_controller/test_case.rb +12 -2
- data/lib/action_dispatch/constants.rb +6 -0
- 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/mime_negotiation.rb +8 -3
- 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 +64 -19
- data/lib/action_dispatch/http/response.rb +49 -14
- data/lib/action_dispatch/http/url.rb +2 -2
- data/lib/action_dispatch/journey/formatter.rb +8 -3
- data/lib/action_dispatch/journey/gtg/transition_table.rb +4 -4
- 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 +19 -4
- data/lib/action_dispatch/middleware/debug_view.rb +0 -5
- data/lib/action_dispatch/middleware/exception_wrapper.rb +3 -9
- data/lib/action_dispatch/middleware/executor.rb +5 -2
- data/lib/action_dispatch/middleware/public_exceptions.rb +5 -1
- 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 +96 -67
- 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/assertion_response.rb +1 -1
- 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 +20 -10
- data/lib/action_dispatch/testing/request_encoder.rb +9 -9
- data/lib/action_dispatch/testing/test_process.rb +1 -2
- data/lib/action_dispatch.rb +6 -4
- data/lib/action_pack/gem_version.rb +4 -4
- metadata +16 -38
- 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: 2effaa8c37f91de6cda898c8ebb9857da735e8c2064c46473f4bd52caa70466c
|
|
4
|
+
data.tar.gz: c42b8c6737bce6b429ea71f66a86fcdc7cd468887c110829b527296d253adbd5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b23a24307dd4d5ffb5d2ac31618809026d8b9620b27382a7b23d321648796b45f6e90d199117b4cc69b39db4d6558ad3dbef075ce5e5543043c57ae5f5cda25
|
|
7
|
+
data.tar.gz: ace10e1524236d4cb72929262e3222c35a09a7abad52bc86b49abf979331261bdbd8860723afe96bc7e98e5a819b5cd62a1fd42f6ce7e31039b399facb61c409
|
data/CHANGELOG.md
CHANGED
|
@@ -1,191 +1,318 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.5 (March 24, 2026) ##
|
|
2
2
|
|
|
3
|
-
* Add
|
|
4
|
-
Developers should use multiple arguments, and different directive methods instead.
|
|
3
|
+
* Add `config.action_controller.live_streaming_excluded_keys` to control execution state sharing in ActionController::Live.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
When using ActionController::Live, actions are executed in a separate thread that shares
|
|
6
|
+
state from the parent thread. This new configuration allows applications to opt-out specific
|
|
7
|
+
state keys that should not be shared.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
This is useful when streaming inside a `connected_to` block, where you may want
|
|
10
|
+
the streaming thread to use its own database connection context.
|
|
9
11
|
|
|
12
|
+
```ruby
|
|
13
|
+
# config/application.rb
|
|
14
|
+
config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
|
|
15
|
+
```
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Fix non-GET requests not updating cookies in `ActionController::TestCase`.
|
|
17
|
+
By default, all keys are shared.
|
|
14
18
|
|
|
15
|
-
*
|
|
19
|
+
*Eileen M. Uchitelle*
|
|
16
20
|
|
|
17
21
|
|
|
18
|
-
## Rails
|
|
22
|
+
## Rails 8.0.4.1 (March 23, 2026) ##
|
|
19
23
|
|
|
20
24
|
* No changes.
|
|
21
25
|
|
|
22
26
|
|
|
23
|
-
## Rails
|
|
27
|
+
## Rails 8.0.4 (October 28, 2025) ##
|
|
24
28
|
|
|
25
|
-
*
|
|
29
|
+
* Submit test requests using `as: :html` with `Content-Type: x-www-form-urlencoded`
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
*Sean Doyle*
|
|
28
32
|
|
|
29
|
-
*John Hawthorn*
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
* URL helpers for engines mounted at the application root handle `SCRIPT_NAME` correctly.
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
Fixed an issue where `SCRIPT_NAME` is not applied to paths generated for routes in an engine
|
|
39
|
+
mounted at "/".
|
|
36
40
|
|
|
41
|
+
*Mike Dalessio*
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
* Fix `Rails.application.reload_routes!` from clearing almost all routes.
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
When calling `Rails.application.reload_routes!` inside a middleware of
|
|
46
|
+
a Rake task, it was possible under certain conditions that all routes would be cleared.
|
|
47
|
+
If ran inside a middleware, this would result in getting a 404 on most page you visit.
|
|
48
|
+
This issue was only happening in development.
|
|
41
49
|
|
|
42
|
-
*
|
|
50
|
+
*Edouard Chin*
|
|
43
51
|
|
|
52
|
+
* Address `rack 3.2` deprecations warnings.
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
```
|
|
55
|
+
warning: Status code :unprocessable_entity is deprecated and will be removed in a future version of Rack.
|
|
56
|
+
Please use :unprocessable_content instead.
|
|
57
|
+
```
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
Rails API will transparently convert one into the other for the foreseeable future.
|
|
48
60
|
|
|
49
|
-
*
|
|
61
|
+
*Earlopain*, *Jean Boussier*
|
|
50
62
|
|
|
51
|
-
*
|
|
52
|
-
[CVE-2024-28103]
|
|
63
|
+
* Support hash-source in Content Security Policy.
|
|
53
64
|
|
|
54
|
-
*
|
|
65
|
+
*madogiwa*
|
|
55
66
|
|
|
56
|
-
*
|
|
67
|
+
* Always return empty body for HEAD requests in `PublicExceptions` and
|
|
68
|
+
`DebugExceptions`.
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
This is required by `Rack::Lint` (per RFC9110).
|
|
59
71
|
|
|
60
|
-
*
|
|
61
|
-
suggested correct location for the missing template.
|
|
72
|
+
*Hartley McGuire*
|
|
62
73
|
|
|
63
|
-
*Joshua Young*
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
A similar helper with matching signature has been added to integration tests.
|
|
77
|
+
* No changes.
|
|
69
78
|
|
|
70
|
-
|
|
79
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
71
80
|
|
|
72
|
-
*
|
|
81
|
+
* Improve `with_routing` test helper to not rebuild the middleware stack.
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
Otherwise some middleware configuration could be lost.
|
|
84
|
+
|
|
85
|
+
*Édouard Chin*
|
|
86
|
+
|
|
87
|
+
* Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
|
|
88
|
+
|
|
89
|
+
This makes it easier to locate the source of the problem, especially for routes drawn by gems.
|
|
90
|
+
|
|
91
|
+
Before:
|
|
92
|
+
```
|
|
93
|
+
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
After:
|
|
80
97
|
```
|
|
98
|
+
Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
*Jeremy Green*
|
|
102
|
+
|
|
103
|
+
* Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
|
|
104
|
+
|
|
105
|
+
Prevents various security scanners from causing exceptions.
|
|
106
|
+
|
|
107
|
+
*Martin Emde*
|
|
108
|
+
|
|
109
|
+
* Fix `ActionDispatch::Executor` to unwrap exceptions like other error reporting middlewares.
|
|
110
|
+
|
|
111
|
+
*Jean Boussier*
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
115
|
+
|
|
116
|
+
* Add `ActionDispatch::Request::Session#store` method to conform Rack spec.
|
|
117
|
+
|
|
118
|
+
*Yaroslav*
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
122
|
+
|
|
123
|
+
* Add validation to content security policies to disallow spaces and semicolons.
|
|
124
|
+
Developers should use multiple arguments, and different directive methods instead.
|
|
125
|
+
|
|
126
|
+
[CVE-2024-54133]
|
|
127
|
+
|
|
128
|
+
*Gannon McGibbon*
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
132
|
+
|
|
133
|
+
* No changes.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
81
137
|
|
|
82
|
-
|
|
138
|
+
* Fix routes with `::` in the path.
|
|
83
139
|
|
|
84
|
-
*
|
|
140
|
+
*Rafael Mendonça França*
|
|
141
|
+
|
|
142
|
+
* Maintain Rack 2 parameter parsing behaviour.
|
|
143
|
+
|
|
144
|
+
*Matthew Draper*
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
148
|
+
|
|
149
|
+
* Remove `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
|
|
150
|
+
|
|
151
|
+
*Rafael Mendonça França*
|
|
152
|
+
|
|
153
|
+
* Improve `ActionController::TestCase` to expose a binary encoded `request.body`.
|
|
85
154
|
|
|
86
|
-
|
|
155
|
+
The rack spec clearly states:
|
|
87
156
|
|
|
88
|
-
|
|
157
|
+
> The input stream is an IO-like object which contains the raw HTTP POST data.
|
|
158
|
+
> When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode.
|
|
89
159
|
|
|
90
|
-
|
|
160
|
+
Until now its encoding was generally UTF-8, which doesn't accurately reflect production
|
|
161
|
+
behavior.
|
|
91
162
|
|
|
92
|
-
*
|
|
163
|
+
*Jean Boussier*
|
|
93
164
|
|
|
94
|
-
|
|
165
|
+
* Update `ActionController::AllowBrowser` to support passing method names to `:block`
|
|
95
166
|
|
|
96
167
|
```ruby
|
|
97
168
|
class ApplicationController < ActionController::Base
|
|
98
|
-
|
|
99
|
-
allow_browser versions: :modern
|
|
100
|
-
end
|
|
169
|
+
allow_browser versions: :modern, block: :handle_outdated_browser
|
|
101
170
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
171
|
+
private
|
|
172
|
+
def handle_outdated_browser
|
|
173
|
+
render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable
|
|
174
|
+
end
|
|
105
175
|
end
|
|
176
|
+
```
|
|
106
177
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
178
|
+
*Sean Doyle*
|
|
179
|
+
|
|
180
|
+
* Raise an `ArgumentError` when invalid `:only` or `:except` options are passed into `#resource` and `#resources`.
|
|
181
|
+
|
|
182
|
+
*Joshua Young*
|
|
183
|
+
|
|
184
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
185
|
+
|
|
186
|
+
* Fix non-GET requests not updating cookies in `ActionController::TestCase`.
|
|
187
|
+
|
|
188
|
+
*Jon Moss*, *Hartley McGuire*
|
|
189
|
+
|
|
190
|
+
* Update `ActionController::Live` to use a thread-pool to reuse threads across requests.
|
|
191
|
+
|
|
192
|
+
*Adam Renberg Tamm*
|
|
193
|
+
|
|
194
|
+
* Introduce safer, more explicit params handling method with `params#expect` such that
|
|
195
|
+
`params.expect(table: [ :attr ])` replaces `params.require(:table).permit(:attr)`
|
|
196
|
+
|
|
197
|
+
Ensures params are filtered with consideration for the expected
|
|
198
|
+
types of values, improving handling of params and avoiding ignorable
|
|
199
|
+
errors caused by params tampering.
|
|
200
|
+
|
|
201
|
+
```ruby
|
|
202
|
+
# If the url is altered to ?person=hacked
|
|
203
|
+
# Before
|
|
204
|
+
params.require(:person).permit(:name, :age, pets: [:name])
|
|
205
|
+
# raises NoMethodError, causing a 500 and potential error reporting
|
|
206
|
+
|
|
207
|
+
# After
|
|
208
|
+
params.expect(person: [ :name, :age, pets: [[:name]] ])
|
|
209
|
+
# raises ActionController::ParameterMissing, correctly returning a 400 error
|
|
111
210
|
```
|
|
112
211
|
|
|
113
|
-
|
|
212
|
+
You may also notice the new double array `[[:name]]`. In order to
|
|
213
|
+
declare when a param is expected to be an array of parameter hashes,
|
|
214
|
+
this new double array syntax is used to explicitly declare an array.
|
|
215
|
+
`expect` requires you to declare expected arrays in this way, and will
|
|
216
|
+
ignore arrays that are passed when, for example, `pet: [:name]` is used.
|
|
114
217
|
|
|
115
|
-
|
|
218
|
+
In order to preserve compatibility, `permit` does not adopt the new
|
|
219
|
+
double array syntax and is therefore more permissive about unexpected
|
|
220
|
+
types. Using `expect` everywhere is recommended.
|
|
221
|
+
|
|
222
|
+
We suggest replacing `params.require(:person).permit(:name, :age)`
|
|
223
|
+
with the direct replacement `params.expect(person: [:name, :age])`
|
|
224
|
+
to prevent external users from manipulating params to trigger 500
|
|
225
|
+
errors. A 400 error will be returned instead, using public/400.html
|
|
226
|
+
|
|
227
|
+
Usage of `params.require(:id)` should likewise be replaced with
|
|
228
|
+
`params.expect(:id)` which is designed to ensure that `params[:id]`
|
|
229
|
+
is a scalar and not an array or hash, also requiring the param.
|
|
116
230
|
|
|
117
231
|
```ruby
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
end
|
|
232
|
+
# Before
|
|
233
|
+
User.find(params.require(:id)) # allows an array, altering behavior
|
|
121
234
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
|
|
125
|
-
end
|
|
235
|
+
# After
|
|
236
|
+
User.find(params.expect(:id)) # expect only returns non-blank permitted scalars (excludes Hash, Array, nil, "", etc)
|
|
126
237
|
```
|
|
127
238
|
|
|
128
|
-
*
|
|
239
|
+
*Martin Emde*
|
|
129
240
|
|
|
130
|
-
*
|
|
241
|
+
* System Testing: Disable Chrome's search engine choice by default in system tests.
|
|
131
242
|
|
|
132
|
-
*
|
|
243
|
+
*glaszig*
|
|
133
244
|
|
|
134
|
-
*
|
|
245
|
+
* Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
|
|
135
246
|
|
|
136
|
-
|
|
247
|
+
*Hartley McGuire*
|
|
137
248
|
|
|
138
|
-
|
|
249
|
+
* Remove `racc` dependency by manually writing `ActionDispatch::Journey::Scanner`.
|
|
139
250
|
|
|
140
|
-
*
|
|
251
|
+
*Gannon McGibbon*
|
|
252
|
+
|
|
253
|
+
* Speed up `ActionDispatch::Routing::Mapper::Scope#[]` by merging frame hashes.
|
|
141
254
|
|
|
142
255
|
*Gannon McGibbon*
|
|
143
256
|
|
|
144
|
-
*
|
|
257
|
+
* Allow bots to ignore `allow_browser`.
|
|
145
258
|
|
|
146
|
-
*
|
|
259
|
+
*Matthew Nguyen*
|
|
147
260
|
|
|
148
|
-
*
|
|
261
|
+
* Deprecate drawing routes with multiple paths to make routing faster.
|
|
262
|
+
You may use `with_options` or a loop to make drawing multiple paths easier.
|
|
149
263
|
|
|
150
|
-
|
|
264
|
+
```ruby
|
|
265
|
+
# Before
|
|
266
|
+
get "/users", "/other_path", to: "users#index"
|
|
151
267
|
|
|
152
|
-
|
|
268
|
+
# After
|
|
269
|
+
get "/users", to: "users#index"
|
|
270
|
+
get "/other_path", to: "users#index"
|
|
271
|
+
```
|
|
153
272
|
|
|
154
|
-
*
|
|
273
|
+
*Gannon McGibbon*
|
|
155
274
|
|
|
156
|
-
*
|
|
275
|
+
* Make `http_cache_forever` use `immutable: true`
|
|
157
276
|
|
|
158
|
-
*
|
|
277
|
+
*Nate Matykiewicz*
|
|
159
278
|
|
|
160
|
-
*
|
|
279
|
+
* Add `config.action_dispatch.strict_freshness`.
|
|
161
280
|
|
|
162
|
-
|
|
281
|
+
When set to `true`, the `ETag` header takes precedence over the `Last-Modified` header when both are present,
|
|
282
|
+
as specified by RFC 7232, Section 6.
|
|
163
283
|
|
|
164
|
-
|
|
284
|
+
Defaults to `false` to maintain compatibility with previous versions of Rails, but is enabled as part of
|
|
285
|
+
Rails 8.0 defaults.
|
|
165
286
|
|
|
166
|
-
*
|
|
287
|
+
*heka1024*
|
|
167
288
|
|
|
168
|
-
*
|
|
169
|
-
error with parallel system tests.
|
|
289
|
+
* Support `immutable` directive in Cache-Control
|
|
170
290
|
|
|
171
|
-
|
|
291
|
+
```ruby
|
|
292
|
+
expires_in 1.minute, public: true, immutable: true
|
|
293
|
+
# Cache-Control: public, max-age=60, immutable
|
|
294
|
+
```
|
|
172
295
|
|
|
173
|
-
*
|
|
296
|
+
*heka1024*
|
|
174
297
|
|
|
175
|
-
|
|
176
|
-
* Remove deprecated constant `ActionDispatch::IllegalStateError`.
|
|
298
|
+
* Add `:wasm_unsafe_eval` mapping for `content_security_policy`
|
|
177
299
|
|
|
178
|
-
|
|
300
|
+
```ruby
|
|
301
|
+
# Before
|
|
302
|
+
policy.script_src "'wasm-unsafe-eval'"
|
|
303
|
+
|
|
304
|
+
# After
|
|
305
|
+
policy.script_src :wasm_unsafe_eval
|
|
306
|
+
```
|
|
179
307
|
|
|
180
|
-
*
|
|
308
|
+
*Joe Haig*
|
|
181
309
|
|
|
182
|
-
|
|
183
|
-
The result would be like this:
|
|
310
|
+
* Add `display_capture` and `keyboard_map` in `permissions_policy`
|
|
184
311
|
|
|
185
|
-
|
|
312
|
+
*Cyril Blaecke*
|
|
186
313
|
|
|
187
|
-
|
|
314
|
+
* Add `connect` route helper.
|
|
188
315
|
|
|
189
|
-
*
|
|
316
|
+
*Samuel Williams*
|
|
190
317
|
|
|
191
|
-
Please check [7-
|
|
318
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionpack/CHANGELOG.md) for previous changes.
|
data/README.rdoc
CHANGED
|
@@ -52,6 +52,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
|
|
|
52
52
|
|
|
53
53
|
* https://github.com/rails/rails/issues
|
|
54
54
|
|
|
55
|
-
Feature requests should be discussed on the
|
|
55
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
56
56
|
|
|
57
57
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
|
@@ -86,14 +86,10 @@ module AbstractController
|
|
|
86
86
|
controller.public_instance_methods(true) - methods
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
# A
|
|
89
|
+
# A `Set` of method names that should be considered actions. This includes all
|
|
90
90
|
# public instance methods on a controller, less any internal methods (see
|
|
91
91
|
# internal_methods), adding back in any methods that are internal, but still
|
|
92
92
|
# exist on the class itself.
|
|
93
|
-
#
|
|
94
|
-
# #### Returns
|
|
95
|
-
# * `Set` - A set of all methods that should be considered actions.
|
|
96
|
-
#
|
|
97
93
|
def action_methods
|
|
98
94
|
@action_methods ||= begin
|
|
99
95
|
# All public instance methods of this class, including ancestors except for
|
|
@@ -121,9 +117,6 @@ module AbstractController
|
|
|
121
117
|
#
|
|
122
118
|
# MyApp::MyPostsController.controller_path # => "my_app/my_posts"
|
|
123
119
|
#
|
|
124
|
-
# #### Returns
|
|
125
|
-
# * `String`
|
|
126
|
-
#
|
|
127
120
|
def controller_path
|
|
128
121
|
@controller_path ||= name.delete_suffix("Controller").underscore unless anonymous?
|
|
129
122
|
end
|
|
@@ -147,10 +140,6 @@ module AbstractController
|
|
|
147
140
|
# The actual method that is called is determined by calling #method_for_action.
|
|
148
141
|
# If no method can handle the action, then an AbstractController::ActionNotFound
|
|
149
142
|
# error is raised.
|
|
150
|
-
#
|
|
151
|
-
# #### Returns
|
|
152
|
-
# * `self`
|
|
153
|
-
#
|
|
154
143
|
def process(action, ...)
|
|
155
144
|
@_action_name = action.to_s
|
|
156
145
|
|
|
@@ -27,7 +27,7 @@ module AbstractController
|
|
|
27
27
|
def method_missing(symbol, ...)
|
|
28
28
|
unless mime_constant = Mime[symbol]
|
|
29
29
|
raise NoMethodError, "To respond to a custom format, register it as a MIME type first: " \
|
|
30
|
-
"https://guides.rubyonrails.org/
|
|
30
|
+
"https://guides.rubyonrails.org/action_controller_advanced_topics.html#restful-downloads. " \
|
|
31
31
|
"If you meant to respond to a variant like :tablet or :phone, not a custom format, " \
|
|
32
32
|
"be sure to nest your variant response within a format response: " \
|
|
33
33
|
"format.html { |html| html.tablet { ... } }"
|
|
@@ -90,7 +90,7 @@ module AbstractController
|
|
|
90
90
|
#--
|
|
91
91
|
# Implemented by Resolution#modules_for_helpers.
|
|
92
92
|
|
|
93
|
-
# :method:
|
|
93
|
+
# :method: all_helpers_from_path
|
|
94
94
|
# :call-seq: all_helpers_from_path(path)
|
|
95
95
|
#
|
|
96
96
|
# Returns a list of helper names in a given path.
|
|
@@ -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
|