actionpack 4.2.10 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +553 -401
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -3
- data/lib/abstract_controller/base.rb +28 -38
- data/lib/{action_controller → abstract_controller}/caching/fragments.rb +51 -11
- data/lib/abstract_controller/caching.rb +62 -0
- data/lib/abstract_controller/callbacks.rb +52 -19
- data/lib/abstract_controller/collector.rb +4 -9
- data/lib/abstract_controller/error.rb +4 -0
- data/lib/abstract_controller/helpers.rb +4 -3
- data/lib/abstract_controller/railties/routes_helpers.rb +2 -2
- data/lib/abstract_controller/rendering.rb +28 -18
- data/lib/abstract_controller/translation.rb +8 -7
- data/lib/abstract_controller.rb +6 -2
- data/lib/action_controller/api/api_rendering.rb +14 -0
- data/lib/action_controller/api.rb +147 -0
- data/lib/action_controller/base.rb +10 -13
- data/lib/action_controller/caching.rb +13 -58
- data/lib/action_controller/form_builder.rb +48 -0
- data/lib/action_controller/log_subscriber.rb +3 -10
- data/lib/action_controller/metal/basic_implicit_render.rb +11 -0
- data/lib/action_controller/metal/conditional_get.rb +106 -34
- data/lib/action_controller/metal/cookies.rb +1 -3
- data/lib/action_controller/metal/data_streaming.rb +11 -32
- data/lib/action_controller/metal/etag_with_template_digest.rb +1 -1
- data/lib/action_controller/metal/exceptions.rb +11 -6
- data/lib/action_controller/metal/force_ssl.rb +10 -10
- data/lib/action_controller/metal/head.rb +14 -8
- data/lib/action_controller/metal/helpers.rb +15 -6
- data/lib/action_controller/metal/http_authentication.rb +44 -35
- data/lib/action_controller/metal/implicit_render.rb +61 -6
- data/lib/action_controller/metal/instrumentation.rb +5 -5
- data/lib/action_controller/metal/live.rb +66 -88
- data/lib/action_controller/metal/mime_responds.rb +27 -42
- data/lib/action_controller/metal/params_wrapper.rb +8 -8
- data/lib/action_controller/metal/redirecting.rb +32 -9
- data/lib/action_controller/metal/renderers.rb +85 -40
- data/lib/action_controller/metal/rendering.rb +38 -6
- data/lib/action_controller/metal/request_forgery_protection.rb +126 -48
- data/lib/action_controller/metal/rescue.rb +3 -12
- data/lib/action_controller/metal/streaming.rb +4 -4
- data/lib/action_controller/metal/strong_parameters.rb +293 -90
- data/lib/action_controller/metal/testing.rb +1 -12
- data/lib/action_controller/metal/url_for.rb +12 -5
- data/lib/action_controller/metal.rb +88 -63
- data/lib/action_controller/renderer.rb +111 -0
- data/lib/action_controller/template_assertions.rb +9 -0
- data/lib/action_controller/test_case.rb +288 -368
- data/lib/action_controller.rb +12 -9
- data/lib/action_dispatch/http/cache.rb +73 -34
- data/lib/action_dispatch/http/filter_parameters.rb +15 -11
- data/lib/action_dispatch/http/filter_redirect.rb +7 -8
- data/lib/action_dispatch/http/headers.rb +44 -13
- data/lib/action_dispatch/http/mime_negotiation.rb +41 -23
- data/lib/action_dispatch/http/mime_type.rb +126 -90
- data/lib/action_dispatch/http/mime_types.rb +3 -4
- data/lib/action_dispatch/http/parameter_filter.rb +18 -8
- data/lib/action_dispatch/http/parameters.rb +54 -41
- data/lib/action_dispatch/http/request.rb +149 -82
- data/lib/action_dispatch/http/response.rb +206 -102
- data/lib/action_dispatch/http/url.rb +117 -8
- data/lib/action_dispatch/journey/formatter.rb +39 -28
- data/lib/action_dispatch/journey/gtg/transition_table.rb +1 -1
- data/lib/action_dispatch/journey/nfa/dot.rb +0 -2
- data/lib/action_dispatch/journey/nfa/transition_table.rb +1 -46
- data/lib/action_dispatch/journey/nodes/node.rb +14 -4
- data/lib/action_dispatch/journey/parser_extras.rb +4 -0
- data/lib/action_dispatch/journey/path/pattern.rb +38 -42
- data/lib/action_dispatch/journey/route.rb +74 -19
- data/lib/action_dispatch/journey/router/utils.rb +5 -5
- data/lib/action_dispatch/journey/router.rb +5 -9
- data/lib/action_dispatch/journey/routes.rb +14 -15
- data/lib/action_dispatch/journey/visitors.rb +86 -43
- data/lib/action_dispatch/middleware/callbacks.rb +10 -1
- data/lib/action_dispatch/middleware/cookies.rb +189 -135
- data/lib/action_dispatch/middleware/debug_exceptions.rb +124 -49
- data/lib/action_dispatch/middleware/exception_wrapper.rb +21 -21
- data/lib/action_dispatch/middleware/executor.rb +19 -0
- data/lib/action_dispatch/middleware/flash.rb +66 -45
- data/lib/action_dispatch/middleware/params_parser.rb +32 -46
- data/lib/action_dispatch/middleware/public_exceptions.rb +2 -2
- data/lib/action_dispatch/middleware/reloader.rb +14 -58
- data/lib/action_dispatch/middleware/remote_ip.rb +29 -19
- data/lib/action_dispatch/middleware/request_id.rb +11 -6
- data/lib/action_dispatch/middleware/session/abstract_store.rb +23 -11
- data/lib/action_dispatch/middleware/session/cache_store.rb +9 -6
- data/lib/action_dispatch/middleware/session/cookie_store.rb +30 -24
- data/lib/action_dispatch/middleware/session/mem_cache_store.rb +4 -0
- data/lib/action_dispatch/middleware/show_exceptions.rb +11 -9
- data/lib/action_dispatch/middleware/ssl.rb +115 -36
- data/lib/action_dispatch/middleware/stack.rb +44 -40
- data/lib/action_dispatch/middleware/static.rb +51 -35
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +2 -14
- data/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +1 -1
- data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +59 -63
- data/lib/action_dispatch/railtie.rb +2 -2
- data/lib/action_dispatch/request/session.rb +69 -33
- data/lib/action_dispatch/request/utils.rb +51 -19
- data/lib/action_dispatch/routing/inspector.rb +32 -43
- data/lib/action_dispatch/routing/mapper.rb +491 -338
- data/lib/action_dispatch/routing/polymorphic_routes.rb +8 -14
- data/lib/action_dispatch/routing/redirection.rb +3 -3
- data/lib/action_dispatch/routing/route_set.rb +145 -238
- data/lib/action_dispatch/routing/url_for.rb +27 -10
- data/lib/action_dispatch/routing.rb +17 -13
- data/lib/action_dispatch/testing/assertion_response.rb +45 -0
- data/lib/action_dispatch/testing/assertions/response.rb +38 -20
- data/lib/action_dispatch/testing/assertions/routing.rb +11 -10
- data/lib/action_dispatch/testing/assertions.rb +1 -1
- data/lib/action_dispatch/testing/integration.rb +368 -97
- data/lib/action_dispatch/testing/test_process.rb +5 -6
- data/lib/action_dispatch/testing/test_request.rb +22 -31
- data/lib/action_dispatch/testing/test_response.rb +7 -4
- data/lib/action_dispatch.rb +3 -1
- data/lib/action_pack/gem_version.rb +3 -3
- data/lib/action_pack.rb +1 -1
- metadata +30 -34
- data/lib/action_controller/metal/hide_actions.rb +0 -40
- data/lib/action_controller/metal/rack_delegation.rb +0 -32
- data/lib/action_controller/middleware.rb +0 -39
- data/lib/action_controller/model_naming.rb +0 -12
- data/lib/action_dispatch/journey/backwards.rb +0 -5
- data/lib/action_dispatch/journey/router/strexp.rb +0 -27
- data/lib/action_dispatch/testing/assertions/dom.rb +0 -3
- data/lib/action_dispatch/testing/assertions/selector.rb +0 -3
- data/lib/action_dispatch/testing/assertions/tag.rb +0 -3
- /data/lib/action_dispatch/middleware/templates/rescues/{_source.erb → _source.html.erb} +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,670 +1,822 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.0.0 (June 30, 2016) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Add `ActionController#helpers` to get access to the view context at the controller
|
4
|
+
level.
|
4
5
|
|
5
|
-
|
6
|
-
in a path was maintained. This was incorrectly backported to Rails 4.2 which
|
7
|
-
caused a regression.
|
6
|
+
*Rafael Mendonça França*
|
8
7
|
|
9
|
-
|
8
|
+
* Routing: Refactor `:action` default handling to ensure that path
|
9
|
+
parameters are not mutated during route generation.
|
10
10
|
|
11
|
-
|
11
|
+
*Andrew White*
|
12
12
|
|
13
|
-
*
|
13
|
+
* Add extension synonyms `yml` and `yaml` for MIME type `application/x-yaml`.
|
14
14
|
|
15
|
-
|
16
|
-
and will match things like `:format_id` where there are nested resources, e.g:
|
15
|
+
*bogdanvlviv*
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
```
|
17
|
+
* Adds support for including ActionController::Cookies in API controllers.
|
18
|
+
Previously, including the module would raise when trying to define
|
19
|
+
a `cookies` helper method. Skip calling #helper_method if it is not
|
20
|
+
defined -- if we don't have helpers, we needn't define one.
|
23
21
|
|
24
|
-
|
25
|
-
`(.:format)`, `.:format` or `/` at the end of the path. Note that we need to
|
26
|
-
allow for multiple closing parenthesis since the route may be of this form:
|
22
|
+
Fixes #24304
|
27
23
|
|
28
|
-
|
29
|
-
get "/books(/:action(.:format))", controller: "books"
|
30
|
-
```
|
24
|
+
*Ryan T. Hosford*
|
31
25
|
|
32
|
-
|
33
|
-
|
26
|
+
* ETags: Introduce `Response#strong_etag=` and `#weak_etag=` and analogous
|
27
|
+
options for `fresh_when` and `stale?`. `Response#etag=` sets a weak ETag.
|
34
28
|
|
35
|
-
|
29
|
+
Strong ETags are desirable when you're serving byte-for-byte identical
|
30
|
+
responses that support Range requests, like PDFs or videos (typically
|
31
|
+
done by reproxying the response from a backend storage service).
|
32
|
+
Also desirable when fronted by some CDNs that support strong ETags
|
33
|
+
only, like Akamai.
|
36
34
|
|
37
|
-
*
|
35
|
+
*Jeremy Daer*
|
38
36
|
|
37
|
+
* ETags: No longer strips quotes (") from ETag values before comparing them.
|
38
|
+
Quotes are significant, part of the ETag. A quoted ETag and an unquoted
|
39
|
+
one are not the same entity.
|
39
40
|
|
40
|
-
|
41
|
+
*Jeremy Daer*
|
41
42
|
|
42
|
-
*
|
43
|
+
* ETags: Support `If-None-Match: *`. Rarely useful for GET requests; meant
|
44
|
+
to provide some optimistic concurrency control for PUT requests.
|
43
45
|
|
46
|
+
*Jeremy Daer*
|
44
47
|
|
45
|
-
|
48
|
+
* `ActionDispatch::ParamsParser` is deprecated and was removed from the middleware
|
49
|
+
stack. To configure the parameter parsers use `ActionDispatch::Request.parameter_parsers=`.
|
46
50
|
|
47
|
-
*
|
51
|
+
*tenderlove*
|
48
52
|
|
53
|
+
* When a `respond_to` collector with a block doesn't have a response, then
|
54
|
+
a `:no_content` response should be rendered. This brings the default
|
55
|
+
rendering behavior introduced by https://github.com/rails/rails/issues/19036
|
56
|
+
to controller methods employing `respond_to`.
|
49
57
|
|
50
|
-
|
58
|
+
*Justin Coyne*
|
51
59
|
|
52
|
-
*
|
60
|
+
* Add `ActionController::Parameters#dig` on Ruby 2.3 and greater, which
|
61
|
+
behaves the same as `Hash#dig`.
|
53
62
|
|
63
|
+
*Sean Griffin*
|
54
64
|
|
55
|
-
|
65
|
+
* Add request headers in the payload of the `start_processing.action_controller`
|
66
|
+
and `process_action.action_controller` notifications.
|
56
67
|
|
57
|
-
*
|
68
|
+
*Gareth du Plooy*
|
58
69
|
|
59
|
-
|
70
|
+
* Add `action_dispatch_integration_test` load hook. The hook can be used to
|
71
|
+
extend `ActionDispatch::IntegrationTest` once it has been loaded.
|
60
72
|
|
61
|
-
*
|
73
|
+
*Yuichiro Kaneko*
|
62
74
|
|
75
|
+
* Update default rendering policies when the controller action did
|
76
|
+
not explicitly indicate a response.
|
63
77
|
|
64
|
-
|
78
|
+
For API controllers, the implicit render always renders "204 No Content"
|
79
|
+
and does not account for any templates.
|
65
80
|
|
66
|
-
|
81
|
+
For other controllers, the following conditions are checked:
|
67
82
|
|
83
|
+
First, if a template exists for the controller action, it is rendered.
|
84
|
+
This template lookup takes into account the action name, locales, format,
|
85
|
+
variant, template handlers, etc. (see `render` for details).
|
68
86
|
|
69
|
-
|
87
|
+
Second, if other templates exist for the controller action but is not in
|
88
|
+
the right format (or variant, etc.), an `ActionController::UnknownFormat`
|
89
|
+
is raised. The list of available templates is assumed to be a complete
|
90
|
+
enumeration of all the possible formats (or variants, etc.); that is,
|
91
|
+
having only HTML and JSON templates indicate that the controller action is
|
92
|
+
not meant to handle XML requests.
|
70
93
|
|
71
|
-
|
72
|
-
|
94
|
+
Third, if the current request is an "interactive" browser request (the user
|
95
|
+
navigated here by entering the URL in the address bar, submitting a form,
|
96
|
+
clicking on a link, etc. as opposed to an XHR or non-browser API request),
|
97
|
+
`ActionView::UnknownFormat` is raised to display a helpful error
|
98
|
+
message.
|
73
99
|
|
74
|
-
|
100
|
+
Finally, it falls back to the same "204 No Content" behavior as API controllers.
|
75
101
|
|
76
|
-
*
|
102
|
+
*Godfrey Chan*, *Jon Moss*, *Kasper Timm Hansen*, *Mike Clark*, *Matthew Draper*
|
77
103
|
|
78
|
-
|
104
|
+
* Add "application/gzip" as a default mime type.
|
79
105
|
|
80
|
-
*
|
81
|
-
a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
|
82
|
-
"/subdir/subdir/engine_path" instead of "/subdir/engine_path")
|
106
|
+
*Mehmet Emin İNAÇ*
|
83
107
|
|
84
|
-
|
108
|
+
* Add request encoding and response parsing to integration tests.
|
85
109
|
|
86
|
-
|
110
|
+
What previously was:
|
87
111
|
|
88
|
-
|
112
|
+
```ruby
|
113
|
+
require 'test_helper'
|
114
|
+
|
115
|
+
class ApiTest < ActionDispatch::IntegrationTest
|
116
|
+
test 'creates articles' do
|
117
|
+
assert_difference -> { Article.count } do
|
118
|
+
post articles_path(format: :json),
|
119
|
+
params: { article: { title: 'Ahoy!' } }.to_json,
|
120
|
+
headers: { 'Content-Type' => 'application/json' }
|
121
|
+
end
|
122
|
+
|
123
|
+
assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, JSON.parse(response.body))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
```
|
89
127
|
|
90
|
-
|
128
|
+
Can now be written as:
|
91
129
|
|
92
|
-
|
93
|
-
|
130
|
+
```ruby
|
131
|
+
require 'test_helper'
|
94
132
|
|
95
|
-
|
133
|
+
class ApiTest < ActionDispatch::IntegrationTest
|
134
|
+
test 'creates articles' do
|
135
|
+
assert_difference -> { Article.count } do
|
136
|
+
post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
|
137
|
+
end
|
96
138
|
|
139
|
+
assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, response.parsed_body)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
```
|
97
143
|
|
98
|
-
|
144
|
+
Passing `as: :json` to integration test request helpers will set the format,
|
145
|
+
content type and encode the parameters as JSON.
|
99
146
|
|
100
|
-
|
101
|
-
|
147
|
+
Then on the response side, `parsed_body` will parse the body according to the
|
148
|
+
content type the response has.
|
102
149
|
|
103
|
-
|
104
|
-
|
105
|
-
number of arguments (2 for 1)` when performing controller tests.
|
150
|
+
Currently JSON is the only supported MIME type. Add your own with
|
151
|
+
`ActionDispatch::IntegrationTest.register_encoder`.
|
106
152
|
|
107
|
-
*
|
153
|
+
*Kasper Timm Hansen*
|
108
154
|
|
109
|
-
*
|
155
|
+
* Add "image/svg+xml" as a default mime type.
|
110
156
|
|
111
|
-
|
112
|
-
So some headers will be broken if there are some middlewares
|
113
|
-
on `ActionDispatch::SSL` and if it uses `Rack::Utils::HeaderHash`.
|
157
|
+
*DHH*
|
114
158
|
|
115
|
-
|
159
|
+
* Add `-g` and `-c` options to `bin/rails routes`. These options return the url `name`, `verb` and
|
160
|
+
`path` field that match the pattern or match a specific controller.
|
116
161
|
|
162
|
+
Deprecate `CONTROLLER` env variable in `bin/rails routes`.
|
117
163
|
|
118
|
-
|
164
|
+
See #18902.
|
119
165
|
|
120
|
-
*
|
121
|
-
nesting multiple routes.
|
166
|
+
*Anton Davydov*, *Vipul A M*
|
122
167
|
|
123
|
-
|
168
|
+
* Response etags to always be weak: Prefixes 'W/' to value returned by
|
169
|
+
`ActionDispatch::Http::Cache::Response#etag=`, such that etags set in
|
170
|
+
`fresh_when` and `stale?` are weak.
|
124
171
|
|
125
|
-
|
172
|
+
Fixes #17556.
|
126
173
|
|
127
|
-
*
|
128
|
-
even when it was a 304 status code.
|
174
|
+
*Abhishek Yadav*
|
129
175
|
|
130
|
-
|
176
|
+
* Provide the name of HTTP Status code in assertions.
|
131
177
|
|
132
|
-
*
|
178
|
+
*Sean Collins*
|
133
179
|
|
134
|
-
*
|
180
|
+
* More explicit error message when running `rake routes`. `CONTROLLER` argument
|
181
|
+
can now be supplied in different ways:
|
182
|
+
`Rails::WelcomeController`, `Rails::Welcome`, `rails/welcome`.
|
135
183
|
|
136
|
-
|
137
|
-
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
|
138
|
-
Actiondispatch::Http:URL.host to raise a NoMethodError.
|
184
|
+
Fixes #22918.
|
139
185
|
|
140
|
-
*
|
186
|
+
*Edouard Chin*
|
141
187
|
|
142
|
-
*
|
188
|
+
* Allow `ActionController::Parameters` instances as an argument to URL
|
189
|
+
helper methods. An `ArgumentError` will be raised if the passed parameters
|
190
|
+
are not secure.
|
143
191
|
|
144
|
-
|
145
|
-
prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
|
146
|
-
is set, it takes precedence.
|
192
|
+
Fixes #22832.
|
147
193
|
|
148
|
-
|
194
|
+
*Prathamesh Sonpatki*
|
149
195
|
|
150
|
-
|
196
|
+
* Add option for per-form CSRF tokens.
|
151
197
|
|
152
|
-
*
|
153
|
-
assigned.
|
198
|
+
*Greg Ose*, *Ben Toews*
|
154
199
|
|
155
|
-
|
200
|
+
* Fix `ActionController::Parameters#convert_parameters_to_hashes` to return filtered
|
201
|
+
or unfiltered values based on from where it is called, `to_h` or `to_unsafe_h`
|
202
|
+
respectively.
|
156
203
|
|
157
|
-
|
204
|
+
Fixes #22841.
|
158
205
|
|
206
|
+
*Prathamesh Sonpatki*
|
159
207
|
|
160
|
-
|
208
|
+
* Add `ActionController::Parameters#include?`
|
161
209
|
|
162
|
-
*
|
210
|
+
*Justin Coyne*
|
163
211
|
|
212
|
+
* Deprecate `redirect_to :back` in favor of `redirect_back`, which accepts a
|
213
|
+
required `fallback_location` argument, thus eliminating the possibility of a
|
214
|
+
`RedirectBackError`.
|
164
215
|
|
165
|
-
|
216
|
+
*Derek Prior*
|
166
217
|
|
167
|
-
*
|
168
|
-
the
|
218
|
+
* Add `redirect_back` method to `ActionController::Redirecting` to provide a
|
219
|
+
way to safely redirect to the `HTTP_REFERER` if it is present, falling back
|
220
|
+
to a provided redirect otherwise.
|
169
221
|
|
170
|
-
*
|
222
|
+
*Derek Prior*
|
171
223
|
|
172
|
-
*
|
224
|
+
* `ActionController::TestCase` will be moved to its own gem in Rails 5.1.
|
173
225
|
|
174
|
-
|
175
|
-
|
226
|
+
With the speed improvements made to `ActionDispatch::IntegrationTest` we no
|
227
|
+
longer need to keep two separate code bases for testing controllers. In
|
228
|
+
Rails 5.1 `ActionController::TestCase` will be deprecated and moved into a
|
229
|
+
gem outside of Rails source.
|
230
|
+
|
231
|
+
This is a documentation deprecation so that going forward new tests will use
|
232
|
+
`ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.
|
233
|
+
|
234
|
+
*Eileen M. Uchitelle*
|
235
|
+
|
236
|
+
* Add a `response_format` option to `ActionDispatch::DebugExceptions`
|
237
|
+
to configure the format of the response when errors occur in
|
238
|
+
development mode.
|
239
|
+
|
240
|
+
If `response_format` is `:default` the debug info will be rendered
|
241
|
+
in an HTML page. In the other hand, if the provided value is `:api`
|
242
|
+
the debug info will be rendered in the original response format.
|
243
|
+
|
244
|
+
*Jorge Bejar*
|
245
|
+
|
246
|
+
* Change the `protect_from_forgery` prepend default to `false`.
|
247
|
+
|
248
|
+
Per this comment
|
249
|
+
https://github.com/rails/rails/pull/18334#issuecomment-69234050 we want
|
250
|
+
`protect_from_forgery` to default to `prepend: false`.
|
251
|
+
|
252
|
+
`protect_from_forgery` will now be inserted into the callback chain at the
|
253
|
+
point it is called in your application. This is useful for cases where you
|
254
|
+
want to `protect_from_forgery` after you perform required authentication
|
255
|
+
callbacks or other callbacks that are required to run after forgery protection.
|
256
|
+
|
257
|
+
If you want `protect_from_forgery` callbacks to always run first, regardless of
|
258
|
+
position they are called in your application then you can add `prepend: true`
|
259
|
+
to your `protect_from_forgery` call.
|
176
260
|
|
177
261
|
Example:
|
262
|
+
|
178
263
|
```ruby
|
179
|
-
|
180
|
-
get '/home' => 'test#index'
|
181
|
-
mount rack_app, at: '/'
|
182
|
-
end
|
183
|
-
head '/home'
|
184
|
-
assert_response :success
|
264
|
+
protect_from_forgery prepend: true
|
185
265
|
```
|
186
|
-
In this case, a HEAD request runs through the routes the first time and fails
|
187
|
-
to match anything. Then, it runs through the list with the fallback and matches
|
188
|
-
`get '/home'`. The original behavior would match the rack app in the first pass.
|
189
266
|
|
190
|
-
*
|
267
|
+
*Eileen M. Uchitelle*
|
191
268
|
|
192
|
-
*
|
269
|
+
* In url_for, never append a question mark to the URL when the query string
|
270
|
+
is empty anyway. (It used to do that when called like `url_for(controller:
|
271
|
+
'x', action: 'y', q: {})`.)
|
193
272
|
|
194
|
-
|
195
|
-
lost when generating URLs with fewer positional arguments than parameters in
|
196
|
-
the route definition.
|
273
|
+
*Paul Grayson*
|
197
274
|
|
198
|
-
|
275
|
+
* Catch invalid UTF-8 querystring values and respond with BadRequest
|
199
276
|
|
200
|
-
|
277
|
+
Check querystring params for invalid UTF-8 characters, and raise an
|
278
|
+
ActionController::BadRequest error if present. Previously these strings
|
279
|
+
would typically trigger errors further down the stack.
|
201
280
|
|
202
|
-
*
|
203
|
-
the test response.
|
281
|
+
*Grey Baker*
|
204
282
|
|
205
|
-
|
283
|
+
* Parse RSS/ATOM responses as XML, not HTML.
|
206
284
|
|
207
|
-
*
|
285
|
+
*Alexander Kaupanin*
|
208
286
|
|
209
|
-
|
210
|
-
|
287
|
+
* Show helpful message in `BadRequest` exceptions due to invalid path
|
288
|
+
parameter encodings.
|
211
289
|
|
212
|
-
|
213
|
-
* #14903
|
214
|
-
* https://github.com/roidrage/lograge/issues/37
|
290
|
+
Fixes #21923.
|
215
291
|
|
216
|
-
*
|
292
|
+
*Agis Anastasopoulos*
|
217
293
|
|
218
|
-
*
|
294
|
+
* Add the ability of returning arbitrary headers to `ActionDispatch::Static`.
|
219
295
|
|
220
|
-
|
296
|
+
Now ActionDispatch::Static can accept HTTP headers so that developers
|
297
|
+
will have control of returning arbitrary headers like
|
298
|
+
'Access-Control-Allow-Origin' when a response is delivered. They can be
|
299
|
+
configured with `#config`:
|
221
300
|
|
222
|
-
|
223
|
-
of returning a single space " ".
|
301
|
+
Example:
|
224
302
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
303
|
+
config.public_file_server.headers = {
|
304
|
+
"Cache-Control" => "public, max-age=60",
|
305
|
+
"Access-Control-Allow-Origin" => "http://rubyonrails.org"
|
306
|
+
}
|
229
307
|
|
230
|
-
|
308
|
+
*Yuki Nishijima*
|
231
309
|
|
232
|
-
|
310
|
+
* Allow multiple `root` routes in same scope level. Example:
|
233
311
|
|
234
|
-
|
312
|
+
Example:
|
235
313
|
|
236
|
-
|
314
|
+
root 'blog#show', constraints: ->(req) { Hostname.blog_site?(req.host) }
|
315
|
+
root 'landing#show'
|
237
316
|
|
238
|
-
*
|
317
|
+
*Rafael Sales*
|
239
318
|
|
240
|
-
|
319
|
+
* Fix regression in mounted engine named routes generation for app deployed to
|
320
|
+
a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
|
321
|
+
"/subdir/subdir/engine_path" instead of "/subdir/engine_path")
|
241
322
|
|
242
|
-
|
323
|
+
Fixes #20920. Fixes #21459.
|
243
324
|
|
244
|
-
*
|
325
|
+
*Matthew Erhard*
|
245
326
|
|
246
|
-
|
327
|
+
* `ActionDispatch::Response#new` no longer applies default headers. If you want
|
328
|
+
default headers applied to the response object, then call
|
329
|
+
`ActionDispatch::Response.create`. This change only impacts people who are
|
330
|
+
directly constructing an `ActionDispatch::Response` object.
|
247
331
|
|
332
|
+
* Accessing mime types via constants like `Mime::HTML` is deprecated. Please
|
333
|
+
change code like this:
|
248
334
|
|
249
|
-
|
335
|
+
Mime::HTML
|
250
336
|
|
251
|
-
|
252
|
-
`Hash` representation of Parameters object. This is now a preferred way to
|
253
|
-
retrieve unfiltered parameters as we will stop inheriting `AC::Parameters`
|
254
|
-
object in Rails 5.0.
|
337
|
+
To this:
|
255
338
|
|
256
|
-
|
339
|
+
Mime[:html]
|
257
340
|
|
258
|
-
|
259
|
-
|
341
|
+
This change is so that Rails will not manage a list of constants, and fixes
|
342
|
+
an issue where if a type isn't registered you could possibly get the wrong
|
343
|
+
object.
|
260
344
|
|
261
|
-
|
345
|
+
`Mime[:html]` is available in older versions of Rails, too, so you can
|
346
|
+
safely change libraries and plugins and maintain compatibility with
|
347
|
+
multiple versions of Rails.
|
262
348
|
|
263
|
-
|
349
|
+
* `url_for` does not modify its arguments when generating polymorphic URLs.
|
264
350
|
|
265
|
-
*
|
351
|
+
*Bernerd Schaefer*
|
266
352
|
|
267
|
-
|
268
|
-
|
353
|
+
* Make it easier to opt in to `config.force_ssl` and `config.ssl_options` by
|
354
|
+
making them less dangerous to try and easier to disable.
|
355
|
+
|
356
|
+
SSL redirect:
|
357
|
+
* Move `:host` and `:port` options within `redirect: { … }`. Deprecate.
|
358
|
+
* Introduce `:status` and `:body` to customize the redirect response.
|
359
|
+
The 301 permanent default makes it difficult to test the redirect and
|
360
|
+
back out of it since browsers remember the 301. Test with a 302 or 307
|
361
|
+
instead, then switch to 301 once you're confident that all is well.
|
362
|
+
|
363
|
+
HTTP Strict Transport Security (HSTS):
|
364
|
+
* Shorter max-age. Shorten the default max-age from 1 year to 180 days,
|
365
|
+
the low end for https://www.ssllabs.com/ssltest/ grading and greater
|
366
|
+
than the 18-week minimum to qualify for browser preload lists.
|
367
|
+
* Disabling HSTS. Setting `hsts: false` now sets `hsts { expires: 0 }`
|
368
|
+
instead of omitting the header. Omitting does nothing to disable HSTS
|
369
|
+
since browsers hang on to your previous settings until they expire.
|
370
|
+
Sending `{ hsts: { expires: 0 }}` flushes out old browser settings and
|
371
|
+
actually disables HSTS:
|
372
|
+
http://tools.ietf.org/html/rfc6797#section-6.1.1
|
373
|
+
* HSTS Preload. Introduce `preload: true` to set the `preload` flag,
|
374
|
+
indicating that your site may be included in browser preload lists,
|
375
|
+
including Chrome, Firefox, Safari, IE11, and Edge. Submit your site:
|
376
|
+
https://hstspreload.appspot.com
|
377
|
+
|
378
|
+
*Jeremy Daer*
|
269
379
|
|
270
|
-
|
380
|
+
* Update `ActionController::TestSession#fetch` to behave more like
|
381
|
+
`ActionDispatch::Request::Session#fetch` when using non-string keys.
|
271
382
|
|
272
|
-
*
|
383
|
+
*Jeremy Friesen*
|
273
384
|
|
274
|
-
|
275
|
-
|
276
|
-
used instead.
|
385
|
+
* Using strings or symbols for middleware class names is deprecated. Convert
|
386
|
+
things like this:
|
277
387
|
|
278
|
-
|
388
|
+
middleware.use "Foo::Bar"
|
279
389
|
|
280
|
-
|
390
|
+
to this:
|
281
391
|
|
282
|
-
|
392
|
+
middleware.use Foo::Bar
|
283
393
|
|
284
|
-
|
285
|
-
|
286
|
-
authorized delimiters and route as expected.
|
394
|
+
* `ActionController::TestSession` now accepts a default value as well as
|
395
|
+
a block for generating a default value based off the key provided.
|
287
396
|
|
288
|
-
|
397
|
+
This fixes calls to `session#fetch` in `ApplicationController` instances that
|
398
|
+
take more two arguments or a block from raising `ArgumentError: wrong
|
399
|
+
number of arguments (2 for 1)` when performing controller tests.
|
289
400
|
|
290
|
-
*
|
401
|
+
*Matthew Gerrior*
|
291
402
|
|
292
|
-
*
|
293
|
-
|
403
|
+
* Fix `ActionController::Parameters#fetch` overwriting `KeyError` returned by
|
404
|
+
default block.
|
294
405
|
|
295
|
-
|
406
|
+
*Jonas Schuber Erlandsson*, *Roque Pinel*
|
296
407
|
|
297
|
-
|
298
|
-
|
299
|
-
explicit conversion and splatting with `#to_a`:
|
408
|
+
* `ActionController::Parameters` no longer inherits from
|
409
|
+
`HashWithIndifferentAccess`
|
300
410
|
|
301
|
-
|
411
|
+
Inheriting from `HashWithIndifferentAccess` allowed users to call any
|
412
|
+
enumerable methods on `Parameters` object, resulting in a risk of losing the
|
413
|
+
`permitted?` status or even getting back a pure `Hash` object instead of
|
414
|
+
a `Parameters` object with proper sanitization.
|
302
415
|
|
303
|
-
|
416
|
+
By not inheriting from `HashWithIndifferentAccess`, we are able to make
|
417
|
+
sure that all methods that are defined in `Parameters` object will return
|
418
|
+
a proper `Parameters` object with a correct `permitted?` flag.
|
304
419
|
|
305
|
-
*
|
420
|
+
*Prem Sichanugrist*
|
306
421
|
|
307
|
-
|
308
|
-
|
422
|
+
* Replaced `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`
|
423
|
+
from the concurrent-ruby gem.
|
309
424
|
|
310
|
-
*
|
425
|
+
*Jerry D'Antonio*
|
311
426
|
|
312
|
-
*
|
313
|
-
routes.
|
427
|
+
* Add ability to filter parameters based on parent keys.
|
314
428
|
|
315
|
-
|
429
|
+
# matches {credit_card: {code: "xxxx"}}
|
430
|
+
# doesn't match {file: { code: "xxxx"}}
|
431
|
+
config.filter_parameters += [ "credit_card.code" ]
|
316
432
|
|
317
|
-
|
433
|
+
See #13897.
|
318
434
|
|
319
|
-
*
|
435
|
+
*Guillaume Malette*
|
320
436
|
|
321
|
-
|
437
|
+
* Deprecate passing first parameter as `Hash` and default status code for `head` method.
|
322
438
|
|
323
|
-
|
324
|
-
config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')
|
439
|
+
*Mehmet Emin İNAÇ*
|
325
440
|
|
326
|
-
|
441
|
+
* Adds`Rack::Utils::ParameterTypeError` and `Rack::Utils::InvalidParameterError`
|
442
|
+
to the rescue_responses hash in `ExceptionWrapper` (Rack recommends
|
443
|
+
integrators serve 400s for both of these).
|
327
444
|
|
328
|
-
*
|
445
|
+
*Grey Baker*
|
329
446
|
|
330
|
-
|
331
|
-
|
332
|
-
|
447
|
+
* Add support for API only apps.
|
448
|
+
`ActionController::API` is added as a replacement of
|
449
|
+
`ActionController::Base` for this kind of applications.
|
333
450
|
|
334
|
-
*
|
451
|
+
*Santiago Pastorino*, *Jorge Bejar*
|
335
452
|
|
336
|
-
*
|
337
|
-
|
338
|
-
the client supports gzip and a compressed file is on disk.
|
453
|
+
* Remove `assigns` and `assert_template`. Both methods have been extracted
|
454
|
+
into a gem at https://github.com/rails/rails-controller-testing.
|
339
455
|
|
340
|
-
|
456
|
+
See #18950.
|
341
457
|
|
342
|
-
*
|
343
|
-
`HashWithIndifferentAccess` in the next major release. If you use any method
|
344
|
-
that is not available on `ActionController::Parameters` you should consider
|
345
|
-
calling `#to_h` to convert it to a `Hash` first before calling that method.
|
458
|
+
*Alan Guo Xiang Tan*
|
346
459
|
|
347
|
-
|
460
|
+
* `FileHandler` and `Static` middleware initializers accept `index` argument
|
461
|
+
to configure the directory index file name. Defaults to `index` (as in
|
462
|
+
`index.html`).
|
348
463
|
|
349
|
-
|
350
|
-
keys removed. This change is to reflect on a security concern where some
|
351
|
-
method performed on an `ActionController::Parameters` may yield a `Hash`
|
352
|
-
object which does not maintain `permitted?` status. If you would like to
|
353
|
-
get a `Hash` with all the keys intact, duplicate and mark it as permitted
|
354
|
-
before calling `#to_h`.
|
464
|
+
See #20017.
|
355
465
|
|
356
|
-
|
357
|
-
name: 'Senjougahara Hitagi',
|
358
|
-
oddity: 'Heavy stone crab'
|
359
|
-
})
|
360
|
-
params.to_h
|
361
|
-
# => {}
|
466
|
+
*Eliot Sykes*
|
362
467
|
|
363
|
-
|
364
|
-
unsafe_params.to_h
|
365
|
-
# => {"name"=>"Senjougahara Hitagi", "oddity"=>"Heavy stone crab"}
|
468
|
+
* Deprecate `:nothing` option for `render` method.
|
366
469
|
|
367
|
-
|
368
|
-
safe_params.to_h
|
369
|
-
# => {"name"=>"Senjougahara Hitagi"}
|
470
|
+
*Mehmet Emin İNAÇ*
|
370
471
|
|
371
|
-
|
372
|
-
|
373
|
-
in the next minor release.
|
472
|
+
* Fix `rake routes` not showing the right format when
|
473
|
+
nesting multiple routes.
|
374
474
|
|
375
|
-
|
475
|
+
See #18373.
|
376
476
|
|
377
|
-
*
|
477
|
+
*Ravil Bayramgalin*
|
378
478
|
|
379
|
-
|
479
|
+
* Add ability to override default form builder for a controller.
|
380
480
|
|
381
|
-
|
382
|
-
|
383
|
-
|
481
|
+
class AdminController < ApplicationController
|
482
|
+
default_form_builder AdminFormBuilder
|
483
|
+
end
|
384
484
|
|
385
|
-
|
485
|
+
*Kevin McPhillips*
|
386
486
|
|
387
|
-
|
487
|
+
* For actions with no corresponding templates, render `head :no_content`
|
488
|
+
instead of raising an error. This allows for slimmer API controller
|
489
|
+
methods that simply work, without needing further instructions.
|
388
490
|
|
389
|
-
|
390
|
-
digest. The default remains the same - 'SHA1'.
|
491
|
+
See #19036.
|
391
492
|
|
392
|
-
|
493
|
+
*Stephen Bussey*
|
393
494
|
|
394
|
-
*
|
395
|
-
the `responders` gem.
|
495
|
+
* Provide friendlier access to request variants.
|
396
496
|
|
397
|
-
|
497
|
+
request.variant = :phone
|
498
|
+
request.variant.phone? # true
|
499
|
+
request.variant.tablet? # false
|
398
500
|
|
399
|
-
|
501
|
+
request.variant = [:phone, :tablet]
|
502
|
+
request.variant.phone? # true
|
503
|
+
request.variant.desktop? # false
|
504
|
+
request.variant.any?(:phone, :desktop) # true
|
505
|
+
request.variant.any?(:desktop, :watch) # false
|
400
506
|
|
401
|
-
|
402
|
-
When you call `fresh_when @post`, the digest for `posts/show.html.erb`
|
403
|
-
is mixed in so future changes to the HTML will blow HTTP caches for you.
|
404
|
-
This makes it easy to HTTP-cache many more of your actions.
|
507
|
+
*George Claghorn*
|
405
508
|
|
406
|
-
|
407
|
-
|
509
|
+
* Fix regression where a gzip file response would have a Content-type,
|
510
|
+
even when it was a 304 status code.
|
511
|
+
|
512
|
+
See #19271.
|
408
513
|
|
409
|
-
|
514
|
+
*Kohei Suzuki*
|
410
515
|
|
411
|
-
|
516
|
+
* Fix handling of empty `X_FORWARDED_HOST` header in `raw_host_with_port`.
|
412
517
|
|
413
|
-
|
518
|
+
Previously, an empty `X_FORWARDED_HOST` header would cause
|
519
|
+
`Actiondispatch::Http:URL.raw_host_with_port` to return `nil`, causing
|
520
|
+
`Actiondispatch::Http:URL.host` to raise a `NoMethodError`.
|
414
521
|
|
415
|
-
*
|
522
|
+
*Adam Forsyth*
|
416
523
|
|
417
|
-
*
|
418
|
-
in favor of `AbstractController::Helpers::MissingHelperError`.
|
524
|
+
* Allow `Bearer` as token-keyword in `Authorization-Header`.
|
419
525
|
|
420
|
-
|
526
|
+
Additionally to `Token`, the keyword `Bearer` is acceptable as a keyword
|
527
|
+
for the auth-token. The `Bearer` keyword is described in the original
|
528
|
+
OAuth RFC and used in libraries like Angular-JWT.
|
421
529
|
|
422
|
-
|
530
|
+
See #19094.
|
531
|
+
|
532
|
+
*Peter Schröder*
|
533
|
+
|
534
|
+
* Drop request class from `RouteSet` constructor.
|
535
|
+
|
536
|
+
If you would like to use a custom request class, please subclass and implement
|
537
|
+
the `request_class` method.
|
538
|
+
|
539
|
+
*tenderlove@ruby-lang.org*
|
540
|
+
|
541
|
+
* Fallback to `ENV['RAILS_RELATIVE_URL_ROOT']` in `url_for`.
|
542
|
+
|
543
|
+
Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not
|
544
|
+
prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
|
545
|
+
is set, it takes precedence.
|
546
|
+
|
547
|
+
Fixes #5122.
|
548
|
+
|
549
|
+
*Yasyf Mohamedali*
|
550
|
+
|
551
|
+
* Partitioning of routes is now done when the routes are being drawn. This
|
552
|
+
helps to decrease the time spent filtering the routes during the first request.
|
423
553
|
|
424
554
|
*Guo Xiang Tan*
|
425
555
|
|
426
|
-
*
|
427
|
-
|
556
|
+
* Fix regression in functional tests. Responses should have default headers
|
557
|
+
assigned.
|
428
558
|
|
429
|
-
|
559
|
+
See #18423.
|
430
560
|
|
431
|
-
*
|
432
|
-
loopback address.
|
561
|
+
*Jeremy Kemper*, *Yves Senn*
|
433
562
|
|
434
|
-
|
563
|
+
* Deprecate `AbstractController#skip_action_callback` in favor of individual skip_callback methods
|
564
|
+
(which can be made to raise an error if no callback was removed).
|
435
565
|
|
436
|
-
*
|
437
|
-
`env["action_dispatch.original_path"]`
|
566
|
+
*Iain Beeston*
|
438
567
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
available to any custom exceptions_app. The original `PATH_INFO` is now
|
443
|
-
stashed in `env["action_dispatch.original_path"]`.
|
568
|
+
* Alias the `ActionDispatch::Request#uuid` method to `ActionDispatch::Request#request_id`.
|
569
|
+
Due to implementation, `config.log_tags = [:request_id]` also works in substitute
|
570
|
+
for `config.log_tags = [:uuid]`.
|
444
571
|
|
445
|
-
*
|
572
|
+
*David Ilizarov*
|
446
573
|
|
447
|
-
*
|
448
|
-
|
574
|
+
* Change filter on /rails/info/routes to use an actual path regexp from rails
|
575
|
+
and not approximate javascript version. Oniguruma supports much more
|
576
|
+
extensive list of features than javascript regexp engine.
|
449
577
|
|
450
|
-
|
578
|
+
Fixes #18402.
|
579
|
+
|
580
|
+
*Ravil Bayramgalin*
|
581
|
+
|
582
|
+
* Non-string authenticity tokens do not raise NoMethodError when decoding
|
583
|
+
the masked token.
|
451
584
|
|
452
|
-
*
|
453
|
-
space to the response body.
|
585
|
+
*Ville Lautanala*
|
454
586
|
|
455
|
-
|
456
|
-
|
457
|
-
body has a 0-length. This is been fixed since and the workaround is no
|
458
|
-
longer necessary.
|
587
|
+
* Add `http_cache_forever` to Action Controller, so we can cache a response
|
588
|
+
that never gets expired.
|
459
589
|
|
460
|
-
|
590
|
+
*arthurnn*
|
461
591
|
|
462
|
-
|
592
|
+
* `ActionController#translate` supports symbols as shortcuts.
|
593
|
+
When a shortcut is given it also performs the lookup without the action
|
594
|
+
name.
|
463
595
|
|
464
|
-
*
|
596
|
+
*Max Melentiev*
|
465
597
|
|
466
|
-
*
|
467
|
-
|
598
|
+
* Expand `ActionController::ConditionalGet#fresh_when` and `stale?` to also
|
599
|
+
accept a collection of records as the first argument, so that the
|
600
|
+
following code can be written in a shorter form.
|
468
601
|
|
469
|
-
|
602
|
+
# Before
|
603
|
+
def index
|
604
|
+
@articles = Article.all
|
605
|
+
fresh_when(etag: @articles, last_modified: @articles.maximum(:updated_at))
|
606
|
+
end
|
470
607
|
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
608
|
+
# After
|
609
|
+
def index
|
610
|
+
@articles = Article.all
|
611
|
+
fresh_when(@articles)
|
612
|
+
end
|
475
613
|
|
476
|
-
|
614
|
+
*claudiob*
|
477
615
|
|
478
|
-
|
616
|
+
* Explicitly ignored wildcard verbs when searching for HEAD routes before fallback
|
479
617
|
|
480
|
-
|
618
|
+
Fixes an issue where a mounted rack app at root would intercept the HEAD
|
619
|
+
request causing an incorrect behavior during the fall back to GET requests.
|
481
620
|
|
482
|
-
|
621
|
+
Example:
|
483
622
|
|
484
|
-
|
623
|
+
draw do
|
624
|
+
get '/home' => 'test#index'
|
625
|
+
mount rack_app, at: '/'
|
626
|
+
end
|
627
|
+
head '/home'
|
628
|
+
assert_response :success
|
485
629
|
|
486
|
-
|
487
|
-
|
630
|
+
In this case, a HEAD request runs through the routes the first time and fails
|
631
|
+
to match anything. Then, it runs through the list with the fallback and matches
|
632
|
+
`get '/home'`. The original behavior would match the rack app in the first pass.
|
488
633
|
|
489
|
-
|
634
|
+
*Terence Sun*
|
490
635
|
|
491
|
-
|
636
|
+
* Discarded flash messages get removed before storing into session.
|
492
637
|
|
493
|
-
*
|
494
|
-
parameters are permitted globally. The default value of this configuration is
|
495
|
-
`['controller', 'action']`.
|
638
|
+
*Samuel Cochran*
|
496
639
|
|
497
|
-
|
640
|
+
* Migrating xhr methods to keyword arguments syntax
|
641
|
+
in `ActionController::TestCase` and `ActionDispatch::Integration`
|
498
642
|
|
499
|
-
|
643
|
+
Old syntax:
|
500
644
|
|
501
|
-
|
645
|
+
xhr :get, :create, params: { id: 1 }
|
502
646
|
|
503
|
-
|
647
|
+
New syntax example:
|
504
648
|
|
505
|
-
|
649
|
+
get :create, params: { id: 1 }, xhr: true
|
506
650
|
|
507
|
-
|
651
|
+
*Kir Shatrov*
|
508
652
|
|
509
|
-
|
653
|
+
* Migrating to keyword arguments syntax in `ActionController::TestCase` and
|
654
|
+
`ActionDispatch::Integration` HTTP request methods.
|
510
655
|
|
511
|
-
|
512
|
-
recognize token as nil, instead of "token".
|
656
|
+
Example:
|
513
657
|
|
514
|
-
|
658
|
+
post :create, params: { y: x }, session: { a: 'b' }
|
659
|
+
get :view, params: { id: 1 }
|
660
|
+
get :view, params: { id: 1 }, format: :json
|
515
661
|
|
516
|
-
*
|
662
|
+
*Kir Shatrov*
|
517
663
|
|
518
|
-
*
|
519
|
-
during live streaming, even when the controller is blocked on a write.
|
664
|
+
* Preserve default url options when generating URLs.
|
520
665
|
|
521
|
-
|
666
|
+
Fixes an issue that would cause `default_url_options` to be lost when
|
667
|
+
generating URLs with fewer positional arguments than parameters in the
|
668
|
+
route definition.
|
522
669
|
|
523
|
-
*
|
524
|
-
application. Use of a symbol should be replaced with `action: symbol`.
|
525
|
-
Use of a string without a "#" should be replaced with `controller: string`.
|
670
|
+
*Tekin Suleyman*
|
526
671
|
|
527
|
-
|
672
|
+
* Deprecate `*_via_redirect` integration test methods.
|
528
673
|
|
529
|
-
|
530
|
-
a trailing slash after `.:format`
|
674
|
+
Use `follow_redirect!` manually after the request call for the same behavior.
|
531
675
|
|
532
|
-
*
|
676
|
+
*Aditya Kapoor*
|
533
677
|
|
534
|
-
*
|
535
|
-
|
536
|
-
is now required in integration test `process` helpers, whereas previously
|
537
|
-
it could be omitted. The fact that this worked was a unintended consequence
|
538
|
-
of the implementation and was never an intentional feature.
|
678
|
+
* Add `ActionController::Renderer` to render arbitrary templates
|
679
|
+
outside controller actions.
|
539
680
|
|
540
|
-
|
681
|
+
Its functionality is accessible through class methods `render` and
|
682
|
+
`renderer` of `ActionController::Base`.
|
541
683
|
|
542
|
-
*
|
543
|
-
called 'status' in a controller.
|
684
|
+
*Ravil Bayramgalin*
|
544
685
|
|
545
|
-
|
686
|
+
* Support `:assigns` option when rendering with controllers/mailers.
|
546
687
|
|
547
|
-
*
|
688
|
+
*Ravil Bayramgalin*
|
548
689
|
|
549
|
-
*
|
690
|
+
* Default headers, removed in controller actions, are no longer reapplied on
|
691
|
+
the test response.
|
550
692
|
|
551
|
-
*
|
693
|
+
*Jonas Baumann*
|
552
694
|
|
553
|
-
*
|
695
|
+
* Deprecate all `*_filter` callbacks in favor of `*_action` callbacks.
|
554
696
|
|
555
|
-
|
556
|
-
for the `*_fragment.action_controller` notifications. This allows tracking
|
557
|
-
e.g. the fragment cache hit rates for each controller action.
|
697
|
+
*Rafael Mendonça França*
|
558
698
|
|
559
|
-
|
699
|
+
* Allow you to pass `prepend: false` to `protect_from_forgery` to have the
|
700
|
+
verification callback appended instead of prepended to the chain.
|
701
|
+
This allows you to let the verification step depend on prior callbacks.
|
560
702
|
|
561
|
-
|
703
|
+
Example:
|
562
704
|
|
563
|
-
|
705
|
+
class ApplicationController < ActionController::Base
|
706
|
+
before_action :authenticate
|
707
|
+
protect_from_forgery prepend: false, unless: -> { @authenticated_by.oauth? }
|
564
708
|
|
565
|
-
|
709
|
+
private
|
710
|
+
def authenticate
|
711
|
+
if oauth_request?
|
712
|
+
# authenticate with oauth
|
713
|
+
@authenticated_by = 'oauth'.inquiry
|
714
|
+
else
|
715
|
+
# authenticate with cookies
|
716
|
+
@authenticated_by = 'cookie'.inquiry
|
717
|
+
end
|
718
|
+
end
|
719
|
+
end
|
566
720
|
|
567
|
-
*
|
568
|
-
and improved tests.
|
721
|
+
*Josef Šimánek*
|
569
722
|
|
570
|
-
|
723
|
+
* Remove `ActionController::HideActions`.
|
571
724
|
|
572
|
-
*
|
725
|
+
*Ravil Bayramgalin*
|
573
726
|
|
574
|
-
*
|
575
|
-
|
576
|
-
silently fail to enforce the constraint. It will now raise an `ArgumentError`
|
577
|
-
when setting up the routes.
|
727
|
+
* Remove `respond_to`/`respond_with` placeholder methods, this functionality
|
728
|
+
has been extracted to the `responders` gem.
|
578
729
|
|
579
|
-
*
|
730
|
+
*Carlos Antonio da Silva*
|
580
731
|
|
581
|
-
*
|
582
|
-
purposes of remote IP detection. Also handle uppercase private IPv6
|
583
|
-
addresses.
|
732
|
+
* Remove deprecated assertion files.
|
584
733
|
|
585
|
-
|
734
|
+
*Rafael Mendonça França*
|
586
735
|
|
587
|
-
|
736
|
+
* Remove deprecated usage of string keys in URL helpers.
|
588
737
|
|
589
|
-
*
|
738
|
+
*Rafael Mendonça França*
|
590
739
|
|
591
|
-
|
592
|
-
cookies are marshal-encoded. This is not the case when `secret_token` is
|
593
|
-
used in conjunction with the `:json` or `:hybrid` serializer.
|
740
|
+
* Remove deprecated `only_path` option on `*_path` helpers.
|
594
741
|
|
595
|
-
|
596
|
-
`TypeError: incompatible marshal file format` and a 500 error for the user.
|
742
|
+
*Rafael Mendonça França*
|
597
743
|
|
598
|
-
|
744
|
+
* Remove deprecated `NamedRouteCollection#helpers`.
|
599
745
|
|
600
|
-
*
|
746
|
+
*Rafael Mendonça França*
|
601
747
|
|
602
|
-
*
|
748
|
+
* Remove deprecated support to define routes with `:to` option that doesn't contain `#`.
|
603
749
|
|
604
|
-
|
605
|
-
2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters
|
606
|
-
3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation
|
607
|
-
4. Use `escape_segment` rather than `escape_path` in URL generation
|
750
|
+
*Rafael Mendonça França*
|
608
751
|
|
609
|
-
|
610
|
-
(e.g. `*foo`) then we use `escape_path` as the value may contain '/' characters. This
|
611
|
-
means that wildcard routes can't be optimized. Secondly, if a `:controller` segment
|
612
|
-
is used in the path then this uses `escape_path` as the controller may be namespaced.
|
752
|
+
* Remove deprecated `ActionDispatch::Response#to_ary`.
|
613
753
|
|
614
|
-
|
754
|
+
*Rafael Mendonça França*
|
615
755
|
|
616
|
-
|
756
|
+
* Remove deprecated `ActionDispatch::Request#deep_munge`.
|
617
757
|
|
618
|
-
*
|
619
|
-
`ActionDispatch::Http::UploadedFile#tempfile`.
|
758
|
+
*Rafael Mendonça França*
|
620
759
|
|
621
|
-
|
760
|
+
* Remove deprecated `ActionDispatch::Http::Parameters#symbolized_path_parameters`.
|
622
761
|
|
623
|
-
*
|
624
|
-
format block.
|
762
|
+
*Rafael Mendonça França*
|
625
763
|
|
626
|
-
|
764
|
+
* Remove deprecated option `use_route` in controller tests.
|
627
765
|
|
628
766
|
*Rafael Mendonça França*
|
629
767
|
|
630
|
-
*
|
768
|
+
* Ensure `append_info_to_payload` is called even if an exception is raised.
|
769
|
+
|
770
|
+
Fixes an issue where when an exception is raised in the request the additional
|
771
|
+
payload data is not available.
|
772
|
+
|
773
|
+
See #14903.
|
774
|
+
|
775
|
+
*Dieter Komendera*, *Margus Pärt*
|
776
|
+
|
777
|
+
* Correctly rely on the response's status code to handle calls to `head`.
|
778
|
+
|
779
|
+
*Robin Dupret*
|
780
|
+
|
781
|
+
* Using `head` method returns empty response_body instead
|
782
|
+
of returning a single space " ".
|
631
783
|
|
632
|
-
|
784
|
+
The old behavior was added as a workaround for a bug in an early
|
785
|
+
version of Safari, where the HTTP headers are not returned correctly
|
786
|
+
if the response body has a 0-length. This is been fixed since and
|
787
|
+
the workaround is no longer necessary.
|
633
788
|
|
634
|
-
|
789
|
+
Fixes #18253.
|
635
790
|
|
636
|
-
|
791
|
+
*Prathamesh Sonpatki*
|
637
792
|
|
638
|
-
|
793
|
+
* Fix how polymorphic routes works with objects that implement `to_model`.
|
639
794
|
|
640
|
-
*
|
795
|
+
*Travis Grathwell*
|
641
796
|
|
642
|
-
|
797
|
+
* Stop converting empty arrays in `params` to `nil`.
|
643
798
|
|
644
|
-
|
645
|
-
|
799
|
+
This behavior was introduced in response to CVE-2012-2660, CVE-2012-2694
|
800
|
+
and CVE-2013-0155
|
646
801
|
|
647
|
-
|
802
|
+
ActiveRecord now issues a safe query when passing an empty array into
|
803
|
+
a where clause, so there is no longer a need to defend against this type
|
804
|
+
of input (any nils are still stripped from the array).
|
648
805
|
|
649
|
-
*
|
806
|
+
*Chris Sinjakli*
|
650
807
|
|
651
|
-
*
|
652
|
-
we need to check if we're not inside a nested scope before copying the :path
|
653
|
-
and :as options to their shallow equivalents.
|
808
|
+
* Remove `ActionController::ModelNaming` module.
|
654
809
|
|
655
|
-
|
810
|
+
*claudiob*
|
656
811
|
|
657
|
-
|
812
|
+
* Fixed usage of optional scopes in url helpers.
|
658
813
|
|
659
|
-
*
|
660
|
-
`log_warning_on_csrf_failure` configuration setting in
|
661
|
-
`ActionController::RequestForgeryProtection`.
|
814
|
+
*Alex Robbin*
|
662
815
|
|
663
|
-
|
816
|
+
* Fixed handling of positional url helper arguments when `format: false`.
|
664
817
|
|
665
|
-
|
666
|
-
`default_url_options` methods.
|
818
|
+
Fixes #17819.
|
667
819
|
|
668
|
-
*
|
820
|
+
*Andrew White*, *Tatiana Soukiassian*
|
669
821
|
|
670
|
-
Please check [4-
|
822
|
+
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/actionpack/CHANGELOG.md) for previous changes.
|