actionpack 8.0.2.1 → 8.1.0.beta1
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 +251 -141
- data/README.rdoc +1 -1
- data/lib/abstract_controller/asset_paths.rb +4 -2
- data/lib/abstract_controller/base.rb +11 -14
- data/lib/abstract_controller/caching.rb +6 -3
- data/lib/abstract_controller/collector.rb +1 -1
- data/lib/abstract_controller/logger.rb +2 -1
- data/lib/action_controller/base.rb +1 -1
- data/lib/action_controller/caching.rb +1 -2
- data/lib/action_controller/form_builder.rb +1 -1
- data/lib/action_controller/log_subscriber.rb +7 -0
- data/lib/action_controller/metal/allow_browser.rb +1 -1
- data/lib/action_controller/metal/conditional_get.rb +25 -0
- data/lib/action_controller/metal/data_streaming.rb +1 -3
- data/lib/action_controller/metal/exceptions.rb +5 -0
- data/lib/action_controller/metal/flash.rb +1 -4
- data/lib/action_controller/metal/head.rb +3 -1
- data/lib/action_controller/metal/live.rb +0 -6
- data/lib/action_controller/metal/permissions_policy.rb +9 -0
- data/lib/action_controller/metal/rate_limiting.rb +22 -7
- data/lib/action_controller/metal/redirecting.rb +63 -7
- data/lib/action_controller/metal/renderers.rb +27 -6
- data/lib/action_controller/metal/rendering.rb +8 -2
- data/lib/action_controller/metal/request_forgery_protection.rb +18 -10
- data/lib/action_controller/metal/rescue.rb +9 -0
- data/lib/action_controller/railtie.rb +2 -6
- data/lib/action_controller/renderer.rb +0 -1
- data/lib/action_dispatch/constants.rb +6 -0
- data/lib/action_dispatch/http/cache.rb +111 -1
- data/lib/action_dispatch/http/content_security_policy.rb +13 -1
- data/lib/action_dispatch/http/filter_parameters.rb +5 -3
- data/lib/action_dispatch/http/mime_negotiation.rb +8 -3
- data/lib/action_dispatch/http/mime_types.rb +1 -0
- data/lib/action_dispatch/http/param_builder.rb +28 -27
- data/lib/action_dispatch/http/parameters.rb +3 -3
- data/lib/action_dispatch/http/permissions_policy.rb +4 -0
- data/lib/action_dispatch/http/query_parser.rb +12 -10
- data/lib/action_dispatch/http/request.rb +10 -5
- data/lib/action_dispatch/http/response.rb +65 -17
- data/lib/action_dispatch/http/url.rb +101 -5
- data/lib/action_dispatch/journey/gtg/simulator.rb +33 -12
- data/lib/action_dispatch/journey/gtg/transition_table.rb +29 -39
- data/lib/action_dispatch/journey/nodes/node.rb +2 -1
- data/lib/action_dispatch/journey/route.rb +45 -31
- data/lib/action_dispatch/journey/router/utils.rb +8 -14
- data/lib/action_dispatch/journey/router.rb +59 -81
- data/lib/action_dispatch/journey/routes.rb +7 -0
- data/lib/action_dispatch/journey/visitors.rb +55 -23
- data/lib/action_dispatch/journey/visualizer/fsm.js +4 -6
- data/lib/action_dispatch/middleware/cookies.rb +4 -2
- data/lib/action_dispatch/middleware/debug_exceptions.rb +10 -2
- data/lib/action_dispatch/middleware/debug_view.rb +11 -0
- data/lib/action_dispatch/middleware/exception_wrapper.rb +14 -8
- data/lib/action_dispatch/middleware/executor.rb +12 -2
- data/lib/action_dispatch/middleware/public_exceptions.rb +6 -6
- data/lib/action_dispatch/middleware/session/cache_store.rb +17 -0
- data/lib/action_dispatch/middleware/templates/rescues/_copy_button.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +3 -2
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +9 -5
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +50 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -0
- data/lib/action_dispatch/railtie.rb +10 -2
- data/lib/action_dispatch/routing/inspector.rb +4 -1
- data/lib/action_dispatch/routing/mapper.rb +323 -173
- data/lib/action_dispatch/routing/route_set.rb +3 -6
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +2 -2
- data/lib/action_dispatch/testing/assertion_response.rb +1 -1
- data/lib/action_dispatch/testing/assertions/response.rb +14 -0
- data/lib/action_dispatch/testing/assertions/routing.rb +11 -3
- data/lib/action_pack/gem_version.rb +3 -3
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed45caa459109b7c6009c7b63f8be21dfe1965dc7bc745e8e7588579a9384391
|
4
|
+
data.tar.gz: aabc44311112b16f6e9b8c3f34f391d1fc1abe91cb1b0df7e920dd0068cbc8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05dc45165c2451cf7a0bd23c7b5baf55ba3e970cde0877211b208f227b98e538237c373135f5d8c3ba905c18af5834d69086ab8e223a11f7d77fed3f0e067746
|
7
|
+
data.tar.gz: 43cba6f2e00ce49bc0b4ef8172eb26b6571325dcfa5c8b5deebcec90cfad8f6d8d7d0804459dc29e5fd36073aa8f1b09348999e6258197360be3306d9c41134e
|
data/CHANGELOG.md
CHANGED
@@ -1,250 +1,360 @@
|
|
1
|
-
## Rails 8.0.
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Remove deprecated support to a route to multiple paths.
|
4
4
|
|
5
|
+
*Rafael Mendonça França*
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
7
|
+
* Remove deprecated support for using semicolons as a query string separator.
|
10
8
|
|
11
|
-
|
9
|
+
Before:
|
12
10
|
|
13
|
-
|
11
|
+
```ruby
|
12
|
+
ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
|
13
|
+
# => [["foo", "bar"], ["baz", "quux"]]
|
14
|
+
```
|
14
15
|
|
15
|
-
|
16
|
+
After:
|
16
17
|
|
17
|
-
|
18
|
+
```ruby
|
19
|
+
ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
|
20
|
+
# => [["foo", "bar;baz=quux"]]
|
21
|
+
```
|
18
22
|
|
19
|
-
*
|
23
|
+
*Rafael Mendonça França*
|
20
24
|
|
21
|
-
|
25
|
+
* Remove deprecated support to skipping over leading brackets in parameter names in the parameter parser.
|
22
26
|
|
23
27
|
Before:
|
24
|
-
|
25
|
-
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "foo" => "bar" }
|
31
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "foo" => { "bar" => "baz" } }
|
26
32
|
```
|
27
33
|
|
28
34
|
After:
|
29
|
-
|
30
|
-
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "[foo]" => "bar" }
|
38
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "[foo]" => { "bar" => "baz" } }
|
31
39
|
```
|
32
40
|
|
33
|
-
*
|
41
|
+
*Rafael Mendonça França*
|
34
42
|
|
35
|
-
*
|
43
|
+
* Deprecate `Rails.application.config.action_dispatch.ignore_leading_brackets`.
|
36
44
|
|
37
|
-
|
45
|
+
*Rafael Mendonça França*
|
38
46
|
|
39
|
-
|
47
|
+
* Raise `ActionController::TooManyRequests` error from `ActionController::RateLimiting`
|
40
48
|
|
41
|
-
|
49
|
+
Requests that exceed the rate limit raise an `ActionController::TooManyRequests` error.
|
50
|
+
By default, Action Dispatch rescues the error and responds with a `429 Too Many Requests` status.
|
42
51
|
|
43
|
-
*
|
52
|
+
*Sean Doyle*
|
44
53
|
|
54
|
+
* Add .md/.markdown as Markdown extensions and add a default `markdown:` renderer:
|
45
55
|
|
46
|
-
|
56
|
+
```ruby
|
57
|
+
class Page
|
58
|
+
def to_markdown
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
47
62
|
|
48
|
-
|
63
|
+
class PagesController < ActionController::Base
|
64
|
+
def show
|
65
|
+
@page = Page.find(params[:id])
|
49
66
|
|
50
|
-
|
67
|
+
respond_to do |format|
|
68
|
+
format.html
|
69
|
+
format.md { render markdown: @page }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
```
|
51
74
|
|
75
|
+
*DHH*
|
52
76
|
|
53
|
-
|
77
|
+
* Add headers to engine routes inspection command
|
54
78
|
|
55
|
-
*
|
56
|
-
Developers should use multiple arguments, and different directive methods instead.
|
79
|
+
*Petrik de Heus*
|
57
80
|
|
58
|
-
|
81
|
+
* Add "Copy as text" button to error pages
|
59
82
|
|
60
|
-
*
|
83
|
+
*Mikkel Malmberg*
|
61
84
|
|
85
|
+
* Add `scope:` option to `rate_limit` method.
|
62
86
|
|
63
|
-
|
87
|
+
Previously, it was not possible to share a rate limit count between several controllers, since the count was by
|
88
|
+
default separate for each controller.
|
64
89
|
|
65
|
-
|
90
|
+
Now, the `scope:` option solves this problem.
|
66
91
|
|
92
|
+
```ruby
|
93
|
+
class APIController < ActionController::API
|
94
|
+
rate_limit to: 2, within: 2.seconds, scope: "api"
|
95
|
+
end
|
67
96
|
|
68
|
-
|
97
|
+
class API::PostsController < APIController
|
98
|
+
# ...
|
99
|
+
end
|
69
100
|
|
70
|
-
|
101
|
+
class API::UsersController < APIController
|
102
|
+
# ...
|
103
|
+
end
|
104
|
+
```
|
71
105
|
|
72
|
-
*
|
106
|
+
*ArthurPV*, *Kamil Hanus*
|
73
107
|
|
74
|
-
*
|
108
|
+
* Add support for `rack.response_finished` callbacks in ActionDispatch::Executor.
|
75
109
|
|
76
|
-
|
110
|
+
The executor middleware now supports deferring completion callbacks to later
|
111
|
+
in the request lifecycle by utilizing Rack's `rack.response_finished` mechanism,
|
112
|
+
when available. This enables applications to define `rack.response_finished` callbacks
|
113
|
+
that may rely on state that would be cleaned up by the executor's completion callbacks.
|
77
114
|
|
115
|
+
*Adrianna Chang*, *Hartley McGuire*
|
78
116
|
|
79
|
-
|
117
|
+
* Produce a log when `rescue_from` is invoked.
|
80
118
|
|
81
|
-
*
|
119
|
+
*Steven Webb*, *Jean Boussier*
|
82
120
|
|
83
|
-
|
121
|
+
* Allow hosts redirects from `hosts` Rails configuration
|
84
122
|
|
85
|
-
|
123
|
+
```ruby
|
124
|
+
config.action_controller.allowed_redirect_hosts << "example.com"
|
125
|
+
```
|
86
126
|
|
87
|
-
|
127
|
+
*Kevin Robatel*
|
88
128
|
|
89
|
-
|
90
|
-
> When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode.
|
129
|
+
* `rate_limit.action_controller` notification has additional payload
|
91
130
|
|
92
|
-
|
93
|
-
behavior.
|
131
|
+
additional values: count, to, within, by, name, cache_key
|
94
132
|
|
95
|
-
*
|
133
|
+
*Jonathan Rochkind*
|
96
134
|
|
97
|
-
*
|
135
|
+
* Add JSON support to the built-in health controller.
|
98
136
|
|
99
|
-
|
100
|
-
|
101
|
-
|
137
|
+
The health controller now responds to JSON requests with a structured response
|
138
|
+
containing status and timestamp information. This makes it easier for monitoring
|
139
|
+
tools and load balancers to consume health check data programmatically.
|
102
140
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
141
|
+
```ruby
|
142
|
+
# /up.json
|
143
|
+
{
|
144
|
+
"status": "up",
|
145
|
+
"timestamp": "2025-09-19T12:00:00Z"
|
146
|
+
}
|
108
147
|
```
|
109
148
|
|
110
|
-
*
|
149
|
+
*Francesco Loreti*, *Juan Vásquez*
|
111
150
|
|
112
|
-
*
|
151
|
+
* Allow to open source file with a crash from the browser.
|
113
152
|
|
114
|
-
*
|
153
|
+
*Igor Kasyanchuk*
|
115
154
|
|
116
|
-
|
155
|
+
* Always check query string keys for valid encoding just like values are checked.
|
117
156
|
|
118
|
-
*
|
157
|
+
*Casper Smits*
|
119
158
|
|
120
|
-
|
159
|
+
* Always return empty body for HEAD requests in `PublicExceptions` and
|
160
|
+
`DebugExceptions`.
|
121
161
|
|
122
|
-
|
162
|
+
This is required by `Rack::Lint` (per RFC9110).
|
123
163
|
|
124
|
-
*
|
164
|
+
*Hartley McGuire*
|
125
165
|
|
126
|
-
*
|
127
|
-
`params.expect(table: [ :attr ])` replaces `params.require(:table).permit(:attr)`
|
166
|
+
* Add comprehensive support for HTTP Cache-Control request directives according to RFC 9111.
|
128
167
|
|
129
|
-
|
130
|
-
types of values, improving handling of params and avoiding ignorable
|
131
|
-
errors caused by params tampering.
|
168
|
+
Provides a `request.cache_control_directives` object that gives access to request cache directives:
|
132
169
|
|
133
170
|
```ruby
|
134
|
-
#
|
135
|
-
#
|
136
|
-
|
137
|
-
#
|
171
|
+
# Boolean directives
|
172
|
+
request.cache_control_directives.only_if_cached? # => true/false
|
173
|
+
request.cache_control_directives.no_cache? # => true/false
|
174
|
+
request.cache_control_directives.no_store? # => true/false
|
175
|
+
request.cache_control_directives.no_transform? # => true/false
|
176
|
+
|
177
|
+
# Value directives
|
178
|
+
request.cache_control_directives.max_age # => integer or nil
|
179
|
+
request.cache_control_directives.max_stale # => integer or nil (or true for valueless max-stale)
|
180
|
+
request.cache_control_directives.min_fresh # => integer or nil
|
181
|
+
request.cache_control_directives.stale_if_error # => integer or nil
|
182
|
+
|
183
|
+
# Special helpers for max-stale
|
184
|
+
request.cache_control_directives.max_stale? # => true if max-stale present (with or without value)
|
185
|
+
request.cache_control_directives.max_stale_unlimited? # => true only for valueless max-stale
|
186
|
+
```
|
138
187
|
|
139
|
-
|
140
|
-
|
141
|
-
|
188
|
+
Example usage:
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
def show
|
192
|
+
if request.cache_control_directives.only_if_cached?
|
193
|
+
@article = Article.find_cached(params[:id])
|
194
|
+
return head(:gateway_timeout) if @article.nil?
|
195
|
+
else
|
196
|
+
@article = Article.find(params[:id])
|
197
|
+
end
|
198
|
+
|
199
|
+
render :show
|
200
|
+
end
|
142
201
|
```
|
143
202
|
|
144
|
-
|
145
|
-
declare when a param is expected to be an array of parameter hashes,
|
146
|
-
this new double array syntax is used to explicitly declare an array.
|
147
|
-
`expect` requires you to declare expected arrays in this way, and will
|
148
|
-
ignore arrays that are passed when, for example, `pet: [:name]` is used.
|
203
|
+
*egg528*
|
149
204
|
|
150
|
-
|
151
|
-
double array syntax and is therefore more permissive about unexpected
|
152
|
-
types. Using `expect` everywhere is recommended.
|
205
|
+
* Add assert_in_body/assert_not_in_body as the simplest way to check if a piece of text is in the response body.
|
153
206
|
|
154
|
-
|
155
|
-
with the direct replacement `params.expect(person: [:name, :age])`
|
156
|
-
to prevent external users from manipulating params to trigger 500
|
157
|
-
errors. A 400 error will be returned instead, using public/400.html
|
207
|
+
*DHH*
|
158
208
|
|
159
|
-
|
160
|
-
`params.expect(:id)` which is designed to ensure that `params[:id]`
|
161
|
-
is a scalar and not an array or hash, also requiring the param.
|
209
|
+
* Include cookie name when calculating maximum allowed size.
|
162
210
|
|
163
|
-
|
164
|
-
# Before
|
165
|
-
User.find(params.require(:id)) # allows an array, altering behavior
|
211
|
+
*Hartley McGuire*
|
166
212
|
|
167
|
-
|
168
|
-
|
213
|
+
* Implement `must-understand` directive according to RFC 9111.
|
214
|
+
|
215
|
+
The `must-understand` directive indicates that a cache must understand the semantics of the response status code, or discard the response. This directive is enforced to be used only with `no-store` to ensure proper cache behavior.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
class ArticlesController < ApplicationController
|
219
|
+
def show
|
220
|
+
@article = Article.find(params[:id])
|
221
|
+
|
222
|
+
if @article.special_format?
|
223
|
+
must_understand
|
224
|
+
render status: 203 # Non-Authoritative Information
|
225
|
+
else
|
226
|
+
fresh_when @article
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
169
230
|
```
|
170
231
|
|
171
|
-
*
|
232
|
+
*heka1024*
|
172
233
|
|
173
|
-
*
|
234
|
+
* The JSON renderer doesn't escape HTML entities or Unicode line separators anymore.
|
174
235
|
|
175
|
-
|
236
|
+
Using `render json:` will no longer escape `<`, `>`, `&`, `U+2028` and `U+2029` characters that can cause errors
|
237
|
+
when the resulting JSON is embedded in JavaScript, or vulnerabilities when the resulting JSON is embedded in HTML.
|
176
238
|
|
177
|
-
|
239
|
+
Since the renderer is used to return a JSON document as `application/json`, it's typically not necessary to escape
|
240
|
+
those characters, and it improves performance.
|
178
241
|
|
179
|
-
|
242
|
+
Escaping will still occur when the `:callback` option is set, since the JSON is used as JavaScript code in this
|
243
|
+
situation (JSONP).
|
180
244
|
|
181
|
-
|
245
|
+
You can use the `:escape` option or set `config.action_controller.escape_json_responses` to `true` to restore the
|
246
|
+
escaping behavior.
|
182
247
|
|
183
|
-
|
248
|
+
```ruby
|
249
|
+
class PostsController < ApplicationController
|
250
|
+
def index
|
251
|
+
render json: Post.last(30), escape: true
|
252
|
+
end
|
253
|
+
end
|
254
|
+
```
|
255
|
+
|
256
|
+
*Étienne Barrié*, *Jean Boussier*
|
184
257
|
|
185
|
-
*
|
258
|
+
* Load lazy route sets before inserting test routes
|
259
|
+
|
260
|
+
Without loading lazy route sets early, we miss `after_routes_loaded` callbacks, or risk
|
261
|
+
invoking them with the test routes instead of the real ones if another load is triggered by an engine.
|
186
262
|
|
187
263
|
*Gannon McGibbon*
|
188
264
|
|
189
|
-
*
|
265
|
+
* Raise `AbstractController::DoubleRenderError` if `head` is called after rendering.
|
266
|
+
|
267
|
+
After this change, invoking `head` will lead to an error if response body is already set:
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
class PostController < ApplicationController
|
271
|
+
def index
|
272
|
+
render locals: {}
|
273
|
+
head :ok
|
274
|
+
end
|
275
|
+
end
|
276
|
+
```
|
277
|
+
|
278
|
+
*Iaroslav Kurbatov*
|
190
279
|
|
191
|
-
|
280
|
+
* The Cookie Serializer can now serialize an Active Support SafeBuffer when using message pack.
|
192
281
|
|
193
|
-
|
194
|
-
You may use `with_options` or a loop to make drawing multiple paths easier.
|
282
|
+
Such code would previously produce an error if an application was using messagepack as its cookie serializer.
|
195
283
|
|
196
284
|
```ruby
|
197
|
-
|
198
|
-
|
285
|
+
class PostController < ApplicationController
|
286
|
+
def index
|
287
|
+
flash.notice = t(:hello_html) # This would try to serialize a SafeBuffer, which was not possible.
|
288
|
+
end
|
289
|
+
end
|
290
|
+
```
|
199
291
|
|
200
|
-
|
201
|
-
|
202
|
-
|
292
|
+
*Edouard Chin*
|
293
|
+
|
294
|
+
* Fix `Rails.application.reload_routes!` from clearing almost all routes.
|
295
|
+
|
296
|
+
When calling `Rails.application.reload_routes!` inside a middleware of
|
297
|
+
a Rake task, it was possible under certain conditions that all routes would be cleared.
|
298
|
+
If ran inside a middleware, this would result in getting a 404 on most page you visit.
|
299
|
+
This issue was only happening in development.
|
300
|
+
|
301
|
+
*Edouard Chin*
|
302
|
+
|
303
|
+
* Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
|
304
|
+
|
305
|
+
This makes it easier to locate the source of the problem, especially for routes drawn by gems.
|
306
|
+
|
307
|
+
Before:
|
308
|
+
```
|
309
|
+
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
203
310
|
```
|
204
311
|
|
205
|
-
|
312
|
+
After:
|
313
|
+
```
|
314
|
+
Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
315
|
+
```
|
206
316
|
|
207
|
-
*
|
317
|
+
*Jeremy Green*
|
208
318
|
|
209
|
-
|
319
|
+
* A route pointing to a non-existing controller now returns a 500 instead of a 404.
|
210
320
|
|
211
|
-
|
321
|
+
A controller not existing isn't a routing error that should result
|
322
|
+
in a 404, but a programming error that should result in a 500 and
|
323
|
+
be reported.
|
212
324
|
|
213
|
-
|
214
|
-
|
325
|
+
Until recently, this was hard to untangle because of the support
|
326
|
+
for dynamic `:controller` segment in routes, but since this is
|
327
|
+
deprecated and will be removed in Rails 8.1, we can now easily
|
328
|
+
not consider missing controllers as routing errors.
|
215
329
|
|
216
|
-
|
217
|
-
Rails 8.0 defaults.
|
330
|
+
*Jean Boussier*
|
218
331
|
|
219
|
-
|
332
|
+
* Add `check_collisions` option to `ActionDispatch::Session::CacheStore`.
|
220
333
|
|
221
|
-
|
334
|
+
Newly generated session ids use 128 bits of randomness, which is more than
|
335
|
+
enough to ensure collisions can't happen, but if you need to harden sessions
|
336
|
+
even more, you can enable this option to check in the session store that the id
|
337
|
+
is indeed free you can enable that option. This however incurs an extra write
|
338
|
+
on session creation.
|
222
339
|
|
223
|
-
|
224
|
-
expires_in 1.minute, public: true, immutable: true
|
225
|
-
# Cache-Control: public, max-age=60, immutable
|
226
|
-
```
|
340
|
+
*Shia*
|
227
341
|
|
228
|
-
|
342
|
+
* In ExceptionWrapper, match backtrace lines with built templates more often,
|
343
|
+
allowing improved highlighting of errors within do-end blocks in templates.
|
344
|
+
Fix for Ruby 3.4 to match new method labels in backtrace.
|
229
345
|
|
230
|
-
*
|
346
|
+
*Martin Emde*
|
347
|
+
|
348
|
+
* Allow setting content type with a symbol of the Mime type.
|
231
349
|
|
232
350
|
```ruby
|
233
351
|
# Before
|
234
|
-
|
352
|
+
response.content_type = "text/html"
|
235
353
|
|
236
354
|
# After
|
237
|
-
|
355
|
+
response.content_type = :html
|
238
356
|
```
|
239
357
|
|
240
|
-
*
|
241
|
-
|
242
|
-
* Add `display_capture` and `keyboard_map` in `permissions_policy`
|
243
|
-
|
244
|
-
*Cyril Blaecke*
|
245
|
-
|
246
|
-
* Add `connect` route helper.
|
247
|
-
|
248
|
-
*Samuel Williams*
|
358
|
+
*Petrik de Heus*
|
249
359
|
|
250
|
-
Please check [
|
360
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-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
|
@@ -7,8 +7,10 @@ module AbstractController
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
included do
|
10
|
-
|
11
|
-
:stylesheets_dir, :default_asset_host_protocol, :relative_url_root
|
10
|
+
singleton_class.delegate :asset_host, :asset_host=, :assets_dir, :assets_dir=, :javascripts_dir, :javascripts_dir=,
|
11
|
+
:stylesheets_dir, :stylesheets_dir=, :default_asset_host_protocol, :default_asset_host_protocol=, :relative_url_root, :relative_url_root=, to: :config
|
12
|
+
delegate :asset_host, :asset_host=, :assets_dir, :assets_dir=, :javascripts_dir, :javascripts_dir=,
|
13
|
+
:stylesheets_dir, :stylesheets_dir=, :default_asset_host_protocol, :default_asset_host_protocol=, :relative_url_root, :relative_url_root=, to: :config
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# :markup: markdown
|
4
4
|
|
5
5
|
require "abstract_controller/error"
|
6
|
-
require "active_support/configurable"
|
7
6
|
require "active_support/descendants_tracker"
|
8
7
|
require "active_support/core_ext/module/anonymous"
|
9
8
|
require "active_support/core_ext/module/attr_internal"
|
@@ -47,7 +46,7 @@ module AbstractController
|
|
47
46
|
# Returns the formats that can be processed by the controller.
|
48
47
|
attr_internal :formats
|
49
48
|
|
50
|
-
|
49
|
+
class_attribute :config, instance_predicate: false, default: ActiveSupport::OrderedOptions.new
|
51
50
|
extend ActiveSupport::DescendantsTracker
|
52
51
|
|
53
52
|
class << self
|
@@ -65,6 +64,7 @@ module AbstractController
|
|
65
64
|
unless klass.instance_variable_defined?(:@abstract)
|
66
65
|
klass.instance_variable_set(:@abstract, false)
|
67
66
|
end
|
67
|
+
klass.config = ActiveSupport::InheritableOptions.new(config)
|
68
68
|
super
|
69
69
|
end
|
70
70
|
|
@@ -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,13 +117,14 @@ 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
|
130
123
|
|
124
|
+
def configure # :nodoc:
|
125
|
+
yield config
|
126
|
+
end
|
127
|
+
|
131
128
|
# Refresh the cached action_methods when a new action_method is added.
|
132
129
|
def method_added(name)
|
133
130
|
super
|
@@ -147,10 +144,6 @@ module AbstractController
|
|
147
144
|
# The actual method that is called is determined by calling #method_for_action.
|
148
145
|
# If no method can handle the action, then an AbstractController::ActionNotFound
|
149
146
|
# error is raised.
|
150
|
-
#
|
151
|
-
# #### Returns
|
152
|
-
# * `self`
|
153
|
-
#
|
154
147
|
def process(action, ...)
|
155
148
|
@_action_name = action.to_s
|
156
149
|
|
@@ -201,6 +194,10 @@ module AbstractController
|
|
201
194
|
true
|
202
195
|
end
|
203
196
|
|
197
|
+
def config # :nodoc:
|
198
|
+
@_config ||= self.class.config.inheritable_copy
|
199
|
+
end
|
200
|
+
|
204
201
|
def inspect # :nodoc:
|
205
202
|
"#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>"
|
206
203
|
end
|
@@ -32,13 +32,16 @@ module AbstractController
|
|
32
32
|
included do
|
33
33
|
extend ConfigMethods
|
34
34
|
|
35
|
-
|
35
|
+
singleton_class.delegate :default_static_extension, :default_static_extension=, to: :config
|
36
|
+
delegate :default_static_extension, :default_static_extension=, to: :config
|
36
37
|
self.default_static_extension ||= ".html"
|
37
38
|
|
38
|
-
|
39
|
+
singleton_class.delegate :perform_caching, :perform_caching=, to: :config
|
40
|
+
delegate :perform_caching, :perform_caching=, to: :config
|
39
41
|
self.perform_caching = true if perform_caching.nil?
|
40
42
|
|
41
|
-
|
43
|
+
singleton_class.delegate :enable_fragment_cache_logging, :enable_fragment_cache_logging=, to: :config
|
44
|
+
delegate :enable_fragment_cache_logging, :enable_fragment_cache_logging=, to: :config
|
42
45
|
self.enable_fragment_cache_logging = false
|
43
46
|
|
44
47
|
class_attribute :_view_cache_dependencies, default: []
|
@@ -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 { ... } }"
|