actionpack 5.0.7.2 → 5.1.0.beta1
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 +5 -5
- data/CHANGELOG.md +189 -1002
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/abstract_controller.rb +3 -3
- data/lib/abstract_controller/base.rb +10 -12
- data/lib/abstract_controller/caching.rb +6 -3
- data/lib/abstract_controller/caching/fragments.rb +1 -1
- data/lib/abstract_controller/callbacks.rb +2 -43
- data/lib/abstract_controller/collector.rb +2 -2
- data/lib/abstract_controller/helpers.rb +19 -19
- data/lib/abstract_controller/rendering.rb +9 -11
- data/lib/abstract_controller/translation.rb +3 -3
- data/lib/action_controller.rb +15 -13
- data/lib/action_controller/api.rb +3 -3
- data/lib/action_controller/base.rb +7 -12
- data/lib/action_controller/caching.rb +1 -1
- data/lib/action_controller/log_subscriber.rb +2 -2
- data/lib/action_controller/metal.rb +34 -43
- data/lib/action_controller/metal/conditional_get.rb +10 -9
- data/lib/action_controller/metal/data_streaming.rb +8 -9
- data/lib/action_controller/metal/etag_with_flash.rb +16 -0
- data/lib/action_controller/metal/etag_with_template_digest.rb +15 -15
- data/lib/action_controller/metal/exceptions.rb +4 -14
- data/lib/action_controller/metal/flash.rb +1 -1
- data/lib/action_controller/metal/force_ssl.rb +6 -6
- data/lib/action_controller/metal/head.rb +13 -19
- data/lib/action_controller/metal/helpers.rb +6 -6
- data/lib/action_controller/metal/http_authentication.rb +22 -23
- data/lib/action_controller/metal/implicit_render.rb +2 -5
- data/lib/action_controller/metal/instrumentation.rb +14 -14
- data/lib/action_controller/metal/live.rb +15 -16
- data/lib/action_controller/metal/mime_responds.rb +3 -3
- data/lib/action_controller/metal/parameter_encoding.rb +49 -0
- data/lib/action_controller/metal/params_wrapper.rb +32 -32
- data/lib/action_controller/metal/redirecting.rb +8 -24
- data/lib/action_controller/metal/renderers.rb +2 -3
- data/lib/action_controller/metal/rendering.rb +50 -60
- data/lib/action_controller/metal/request_forgery_protection.rb +51 -49
- data/lib/action_controller/metal/rescue.rb +1 -1
- data/lib/action_controller/metal/streaming.rb +4 -4
- data/lib/action_controller/metal/strong_parameters.rb +117 -250
- data/lib/action_controller/metal/testing.rb +1 -1
- data/lib/action_controller/metal/url_for.rb +4 -4
- data/lib/action_controller/railtie.rb +9 -13
- data/lib/action_controller/renderer.rb +17 -16
- data/lib/action_controller/test_case.rb +75 -148
- data/lib/action_dispatch.rb +20 -19
- data/lib/action_dispatch/http/cache.rb +9 -10
- data/lib/action_dispatch/http/filter_parameters.rb +8 -8
- data/lib/action_dispatch/http/filter_redirect.rb +2 -4
- data/lib/action_dispatch/http/headers.rb +10 -10
- data/lib/action_dispatch/http/mime_negotiation.rb +17 -22
- data/lib/action_dispatch/http/mime_type.rb +27 -52
- data/lib/action_dispatch/http/parameter_filter.rb +8 -6
- data/lib/action_dispatch/http/parameters.rb +40 -17
- data/lib/action_dispatch/http/request.rb +38 -34
- data/lib/action_dispatch/http/response.rb +16 -16
- data/lib/action_dispatch/http/upload.rb +6 -10
- data/lib/action_dispatch/http/url.rb +48 -74
- data/lib/action_dispatch/journey.rb +5 -5
- data/lib/action_dispatch/journey/formatter.rb +8 -4
- data/lib/action_dispatch/journey/gtg/builder.rb +5 -5
- data/lib/action_dispatch/journey/gtg/simulator.rb +1 -1
- data/lib/action_dispatch/journey/gtg/transition_table.rb +15 -15
- data/lib/action_dispatch/journey/nfa/builder.rb +3 -3
- data/lib/action_dispatch/journey/nfa/dot.rb +2 -2
- data/lib/action_dispatch/journey/nfa/simulator.rb +1 -1
- data/lib/action_dispatch/journey/nfa/transition_table.rb +2 -2
- data/lib/action_dispatch/journey/nodes/node.rb +5 -5
- data/lib/action_dispatch/journey/parser.rb +23 -24
- data/lib/action_dispatch/journey/parser.y +3 -2
- data/lib/action_dispatch/journey/parser_extras.rb +2 -2
- data/lib/action_dispatch/journey/path/pattern.rb +10 -3
- data/lib/action_dispatch/journey/route.rb +19 -12
- data/lib/action_dispatch/journey/router.rb +19 -12
- data/lib/action_dispatch/journey/router/utils.rb +9 -9
- data/lib/action_dispatch/journey/scanner.rb +17 -15
- data/lib/action_dispatch/journey/visitors.rb +23 -23
- data/lib/action_dispatch/middleware/callbacks.rb +0 -12
- data/lib/action_dispatch/middleware/cookies.rb +39 -39
- data/lib/action_dispatch/middleware/debug_exceptions.rb +126 -112
- data/lib/action_dispatch/middleware/debug_locks.rb +8 -8
- data/lib/action_dispatch/middleware/exception_wrapper.rb +55 -55
- data/lib/action_dispatch/middleware/executor.rb +1 -1
- data/lib/action_dispatch/middleware/flash.rb +17 -16
- data/lib/action_dispatch/middleware/public_exceptions.rb +20 -20
- data/lib/action_dispatch/middleware/reloader.rb +3 -47
- data/lib/action_dispatch/middleware/remote_ip.rb +6 -8
- data/lib/action_dispatch/middleware/request_id.rb +6 -5
- data/lib/action_dispatch/middleware/session/abstract_store.rb +14 -26
- data/lib/action_dispatch/middleware/session/cache_store.rb +3 -3
- data/lib/action_dispatch/middleware/session/cookie_store.rb +35 -35
- data/lib/action_dispatch/middleware/session/mem_cache_store.rb +2 -2
- data/lib/action_dispatch/middleware/show_exceptions.rb +19 -19
- data/lib/action_dispatch/middleware/ssl.rb +9 -27
- data/lib/action_dispatch/middleware/stack.rb +7 -26
- data/lib/action_dispatch/middleware/static.rb +13 -24
- data/lib/action_dispatch/railtie.rb +9 -11
- data/lib/action_dispatch/request/session.rb +22 -22
- data/lib/action_dispatch/request/utils.rb +11 -2
- data/lib/action_dispatch/routing.rb +8 -6
- data/lib/action_dispatch/routing/inspector.rb +37 -37
- data/lib/action_dispatch/routing/mapper.rb +296 -203
- data/lib/action_dispatch/routing/polymorphic_routes.rb +160 -134
- data/lib/action_dispatch/routing/redirection.rb +27 -22
- data/lib/action_dispatch/routing/route_set.rb +206 -92
- data/lib/action_dispatch/routing/routes_proxy.rb +2 -2
- data/lib/action_dispatch/routing/url_for.rb +14 -12
- data/lib/action_dispatch/system_test_case.rb +119 -0
- data/lib/action_dispatch/system_testing/browser.rb +28 -0
- data/lib/action_dispatch/system_testing/driver.rb +18 -0
- data/lib/action_dispatch/system_testing/server.rb +32 -0
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +61 -0
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +20 -0
- data/lib/action_dispatch/testing/assertion_response.rb +6 -6
- data/lib/action_dispatch/testing/assertions.rb +4 -4
- data/lib/action_dispatch/testing/assertions/response.rb +8 -3
- data/lib/action_dispatch/testing/assertions/routing.rb +11 -11
- data/lib/action_dispatch/testing/integration.rb +47 -138
- data/lib/action_dispatch/testing/test_process.rb +2 -2
- data/lib/action_dispatch/testing/test_request.rb +16 -16
- data/lib/action_dispatch/testing/test_response.rb +1 -1
- data/lib/action_pack.rb +2 -2
- data/lib/action_pack/gem_version.rb +3 -3
- data/lib/action_pack/version.rb +1 -1
- metadata +20 -12
- data/lib/action_dispatch/middleware/params_parser.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31324527153bfbfe3aa7aa7dda8ee8c331b7b710
|
4
|
+
data.tar.gz: 9043792bce8eb9b28e7827da36e7e1039fa1922e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e810049812b0d854b469613e1c794f8cc6effbcf6f5f67b70d767c7cddcef1d596796407650c20c8dfd20075d893bef86c1f0e279e8e7fee4d24d0c141c1438
|
7
|
+
data.tar.gz: ea384d5626690a79f854e1503b46fb50cb6f9d82321526d00b16afacca3ebfcb6785887be76b2312724f224ec6ab79fd11ef9e400d26a5194c124abeabdb5194
|
data/CHANGELOG.md
CHANGED
@@ -1,231 +1,254 @@
|
|
1
|
-
## Rails 5.0.
|
1
|
+
## Rails 5.1.0.beta1 (February 23, 2017) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Prefer `remove_method` over `undef_method` when reloading routes
|
4
4
|
|
5
|
+
When `undef_method` is used it prevents access to other implementations of that
|
6
|
+
url helper in the ancestor chain so use `remove_method` instead to restore access.
|
5
7
|
|
6
|
-
|
8
|
+
*Andrew White*
|
7
9
|
|
8
|
-
*
|
10
|
+
* Add the `resolve` method to the routing DSL
|
9
11
|
|
12
|
+
This new method allows customization of the polymorphic mapping of models:
|
10
13
|
|
11
|
-
|
14
|
+
``` ruby
|
15
|
+
resource :basket
|
16
|
+
resolve(class: "Basket") { [:basket] }
|
17
|
+
```
|
12
18
|
|
13
|
-
|
14
|
-
|
19
|
+
``` erb
|
20
|
+
<%= form_for @basket do |form| %>
|
21
|
+
<!-- basket form -->
|
22
|
+
<% end %>
|
23
|
+
```
|
15
24
|
|
16
|
-
|
25
|
+
This generates the correct singular URL for the form instead of the default
|
26
|
+
resources member url, e.g. `/basket` vs. `/basket/:id`.
|
17
27
|
|
28
|
+
Fixes #1769.
|
18
29
|
|
19
|
-
|
30
|
+
*Andrew White*
|
20
31
|
|
21
|
-
*
|
32
|
+
* Add the `direct` method to the routing DSL
|
22
33
|
|
34
|
+
This new method allows creation of custom url helpers, e.g:
|
23
35
|
|
24
|
-
|
36
|
+
``` ruby
|
37
|
+
direct(:apple) { "http://www.apple.com" }
|
25
38
|
|
26
|
-
|
39
|
+
>> apple_url
|
40
|
+
=> "http://www.apple.com"
|
41
|
+
```
|
27
42
|
|
43
|
+
This has the advantage of being available everywhere url helpers are available
|
44
|
+
unlike custom url helpers defined in helper modules, etc.
|
28
45
|
|
29
|
-
|
46
|
+
*Andrew White*
|
30
47
|
|
31
|
-
*
|
48
|
+
* Add `ActionDispatch::SystemTestCase` to Action Pack
|
32
49
|
|
50
|
+
Adds Capybara integration directly into Rails through Action Pack!
|
33
51
|
|
34
|
-
|
52
|
+
See PR [#26703](https://github.com/rails/rails/pull/26703)
|
35
53
|
|
36
|
-
*
|
54
|
+
*Eileen M. Uchitelle*
|
37
55
|
|
56
|
+
* Remove deprecated `.to_prepare`, `.to_cleanup`, `.prepare!` and `.cleanup!` from `ActionDispatch::Reloader`.
|
38
57
|
|
39
|
-
|
58
|
+
*Rafael Mendonça França*
|
40
59
|
|
41
|
-
*
|
60
|
+
* Remove deprecated `ActionDispatch::Callbacks.to_prepare` and `ActionDispatch::Callbacks.to_cleanup`.
|
42
61
|
|
43
|
-
*
|
62
|
+
*Rafael Mendonça França*
|
44
63
|
|
64
|
+
* Remove deprecated `ActionController::Metal.call`.
|
45
65
|
|
46
|
-
|
66
|
+
*Rafael Mendonça França*
|
47
67
|
|
48
|
-
*
|
68
|
+
* Remove deprecated `ActionController::Metal#env`.
|
49
69
|
|
70
|
+
*Rafael Mendonça França*
|
50
71
|
|
51
|
-
|
72
|
+
* Make `with_routing` test helper work when testing controllers inheriting from `ActionController::API`
|
52
73
|
|
53
|
-
*
|
74
|
+
*Julia López*
|
54
75
|
|
55
|
-
|
56
|
-
`config.action_controller.raise_on_unfiltered_parameters` is true.
|
76
|
+
* Use accept header in integration tests with `as: :json`
|
57
77
|
|
58
|
-
|
59
|
-
|
78
|
+
Instead of appending the `format` to the request path, Rails will figure
|
79
|
+
out the format from the header instead.
|
60
80
|
|
61
|
-
|
62
|
-
usually fallback to use `to_unsafe_h` that could potentially introduce security issues.
|
81
|
+
This allows devs to use `:as` on routes that don't have a format.
|
63
82
|
|
64
|
-
|
83
|
+
Fixes #27144.
|
65
84
|
|
66
|
-
*
|
85
|
+
*Kasper Timm Hansen*
|
67
86
|
|
68
|
-
|
69
|
-
requiring the users to change their implementation.
|
87
|
+
* Reset a new session directly after its creation in `ActionDispatch::IntegrationTest#open_session`.
|
70
88
|
|
71
|
-
|
72
|
-
to mimic the same implementation of `ActiveSupport::HashWithIndefirentAccess#to_hash`.
|
89
|
+
Fixes #22742.
|
73
90
|
|
74
|
-
|
75
|
-
`config.action_controller.raise_on_unfiltered_parameters` is true.
|
91
|
+
*Tawan Sierek*
|
76
92
|
|
77
|
-
|
93
|
+
* Fixes incorrect output from `rails routes` when using singular resources.
|
78
94
|
|
79
|
-
|
95
|
+
Fixes #26606.
|
80
96
|
|
81
|
-
|
82
|
-
in an unfiltered parameter. Now we delegate to `#to_h` that already raise an error when
|
83
|
-
the Parameters instance is not permitted.
|
97
|
+
*Erick Reyna*
|
84
98
|
|
85
|
-
|
86
|
-
|
87
|
-
|
99
|
+
* Fixes multiple calls to `logger.fatal` instead of a single call,
|
100
|
+
for every line in an exception backtrace, when printing trace
|
101
|
+
from `DebugExceptions` middleware.
|
88
102
|
|
89
|
-
|
103
|
+
Fixes #26134.
|
90
104
|
|
91
|
-
*
|
105
|
+
*Vipul A M*
|
92
106
|
|
93
|
-
|
94
|
-
and will match things like `:format_id` where there are nested resources, e.g:
|
107
|
+
* Add support for arbitrary hashes in strong parameters:
|
95
108
|
|
96
|
-
```
|
97
|
-
|
98
|
-
resources :items
|
99
|
-
end
|
109
|
+
```ruby
|
110
|
+
params.permit(preferences: {})
|
100
111
|
```
|
101
112
|
|
102
|
-
|
103
|
-
`(.:format)`, `.:format` or `/` at the end of the path. Note that we need to
|
104
|
-
allow for multiple closing parenthesis since the route may be of this form:
|
113
|
+
*Xavier Noria*
|
105
114
|
|
106
|
-
|
107
|
-
get "/books(/:action(.:format))", controller: "books"
|
108
|
-
```
|
115
|
+
* Add `ActionController::Parameters#merge!`, which behaves the same as `Hash#merge!`.
|
109
116
|
|
110
|
-
|
111
|
-
route doesn't support a format but we have a test for it so we need to allow it.
|
117
|
+
*Yuji Yaginuma*
|
112
118
|
|
113
|
-
|
119
|
+
* Allow keys not found in `RACK_KEY_TRANSLATION` for setting the environment when rendering
|
120
|
+
arbitrary templates.
|
114
121
|
|
115
|
-
*
|
122
|
+
*Sammy Larbi*
|
116
123
|
|
117
|
-
*
|
124
|
+
* Remove deprecated support to non-keyword arguments in `ActionDispatch::IntegrationTest#process`,
|
125
|
+
`#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
|
118
126
|
|
119
|
-
|
120
|
-
headers were included in responses from `ActionController::Metai` based controllers.
|
121
|
-
This is now reverted to the previous behavior of having no default headers.
|
127
|
+
*Rafael Mendonça França*
|
122
128
|
|
123
|
-
|
129
|
+
* Remove deprecated `ActionDispatch::IntegrationTest#*_via_redirect`.
|
124
130
|
|
125
|
-
*
|
131
|
+
*Rafael Mendonça França*
|
126
132
|
|
127
|
-
*
|
133
|
+
* Remove deprecated `ActionDispatch::IntegrationTest#xml_http_request`.
|
128
134
|
|
129
|
-
|
130
|
-
returning `nil`. This caused URLs to be malformed with the default settings.
|
131
|
-
Fix this by setting `rack.url_scheme` when the environment is normalized.
|
135
|
+
*Rafael Mendonça França*
|
132
136
|
|
133
|
-
|
137
|
+
* Remove deprecated support for passing `:path` and route path as strings in `ActionDispatch::Routing::Mapper#match`.
|
134
138
|
|
135
|
-
*
|
139
|
+
*Rafael Mendonça França*
|
136
140
|
|
137
|
-
*
|
141
|
+
* Remove deprecated support for passing path as `nil` in `ActionDispatch::Routing::Mapper#match`.
|
138
142
|
|
139
|
-
|
143
|
+
*Rafael Mendonça França*
|
140
144
|
|
141
|
-
|
145
|
+
* Remove deprecated `cache_control` argument from `ActionDispatch::Static#initialize`.
|
142
146
|
|
147
|
+
*Rafael Mendonça França*
|
143
148
|
|
144
|
-
|
149
|
+
* Remove deprecated support to passing strings or symbols to the middleware stack.
|
145
150
|
|
146
|
-
*
|
151
|
+
*Rafael Mendonça França*
|
147
152
|
|
148
|
-
|
153
|
+
* Change HSTS subdomain to true.
|
149
154
|
|
155
|
+
*Rafael Mendonça França*
|
150
156
|
|
151
|
-
|
157
|
+
* Remove deprecated `host` and `port` ssl options.
|
152
158
|
|
153
|
-
*
|
154
|
-
they should pass along any supplied value, they should not add a default.
|
159
|
+
*Rafael Mendonça França*
|
155
160
|
|
156
|
-
|
161
|
+
* Remove deprecated `const_error` argument in
|
162
|
+
`ActionDispatch::Session::SessionRestoreError#initialize`.
|
157
163
|
|
158
|
-
*
|
164
|
+
*Rafael Mendonça França*
|
159
165
|
|
166
|
+
* Remove deprecated `#original_exception` in `ActionDispatch::Session::SessionRestoreError`.
|
160
167
|
|
161
|
-
|
168
|
+
*Rafael Mendonça França*
|
162
169
|
|
163
|
-
*
|
164
|
-
`ActionDispatch::
|
170
|
+
* Deprecate `ActionDispatch::ParamsParser::ParseError` in favor of
|
171
|
+
`ActionDispatch::Http::Parameters::ParseError`.
|
165
172
|
|
166
|
-
*
|
173
|
+
*Rafael Mendonça França*
|
167
174
|
|
168
|
-
*
|
169
|
-
is incompatible with existing (unintended) API usage.
|
175
|
+
* Remove deprecated `ActionDispatch::ParamsParser`.
|
170
176
|
|
171
|
-
*
|
177
|
+
*Rafael Mendonça França*
|
172
178
|
|
179
|
+
* Remove deprecated `original_exception` and `message` arguments in
|
180
|
+
`ActionDispatch::ParamsParser::ParseError#initialize`.
|
173
181
|
|
174
|
-
|
182
|
+
*Rafael Mendonça França*
|
175
183
|
|
176
|
-
*
|
177
|
-
enabled.
|
184
|
+
* Remove deprecated `#original_exception` in `ActionDispatch::ParamsParser::ParseError`.
|
178
185
|
|
179
|
-
|
186
|
+
*Rafael Mendonça França*
|
180
187
|
|
181
|
-
|
188
|
+
* Remove deprecated access to mime types through constants.
|
182
189
|
|
183
|
-
*
|
190
|
+
*Rafael Mendonça França*
|
184
191
|
|
185
|
-
|
186
|
-
|
192
|
+
* Remove deprecated support to non-keyword arguments in `ActionController::TestCase#process`,
|
193
|
+
`#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
|
187
194
|
|
188
|
-
|
195
|
+
*Rafael Mendonça França*
|
189
196
|
|
190
|
-
|
197
|
+
* Remove deprecated `xml_http_request` and `xhr` methods in `ActionController::TestCase`.
|
191
198
|
|
192
|
-
*
|
199
|
+
*Rafael Mendonça França*
|
193
200
|
|
194
|
-
*
|
201
|
+
* Remove deprecated methods in `ActionController::Parameters`.
|
195
202
|
|
196
|
-
|
197
|
-
post "/anything", params: params, headers: headers, as: :json
|
203
|
+
*Rafael Mendonça França*
|
198
204
|
|
199
|
-
|
200
|
-
|
201
|
-
option.
|
205
|
+
* Remove deprecated support to comparing a `ActionController::Parameters`
|
206
|
+
with a `Hash`.
|
202
207
|
|
203
|
-
|
208
|
+
*Rafael Mendonça França*
|
204
209
|
|
205
|
-
*
|
210
|
+
* Remove deprecated support to `:text` in `render`.
|
206
211
|
|
207
|
-
|
212
|
+
*Rafael Mendonça França*
|
208
213
|
|
209
|
-
|
214
|
+
* Remove deprecated support to `:nothing` in `render`.
|
210
215
|
|
211
|
-
*
|
212
|
-
for every line in an exception backtrace, when printing trace
|
213
|
-
from `DebugExceptions` middleware.
|
216
|
+
*Rafael Mendonça França*
|
214
217
|
|
215
|
-
|
218
|
+
* Remove deprecated support to `:back` in `redirect_to`.
|
216
219
|
|
217
|
-
*
|
220
|
+
*Rafael Mendonça França*
|
218
221
|
|
219
|
-
*
|
222
|
+
* Remove deprecated support to passing status as option `head`.
|
220
223
|
|
221
|
-
*
|
224
|
+
*Rafael Mendonça França*
|
225
|
+
|
226
|
+
* Remove deprecated support to passing original exception to `ActionController::BadRequest`
|
227
|
+
and the `ActionController::BadRequest#original_exception` method.
|
228
|
+
|
229
|
+
*Rafael Mendonça França*
|
230
|
+
|
231
|
+
* Remove deprecated methods `skip_action_callback`, `skip_filter`, `before_filter`,
|
232
|
+
`prepend_before_filter`, `skip_before_filter`, `append_before_filter`, `around_filter`
|
233
|
+
`prepend_around_filter`, `skip_around_filter`, `append_around_filter`, `after_filter`,
|
234
|
+
`prepend_after_filter`, `skip_after_filter` and `append_after_filter`.
|
222
235
|
|
223
|
-
*
|
224
|
-
|
236
|
+
*Rafael Mendonça França*
|
237
|
+
|
238
|
+
* Show an "unmatched constraints" error when params fail to match constraints
|
239
|
+
on a matched route, rather than a "missing keys" error.
|
240
|
+
|
241
|
+
Fixes #26470.
|
242
|
+
|
243
|
+
*Chris Carter*
|
225
244
|
|
226
|
-
|
245
|
+
* Fix adding implicitly rendered template digests to ETags.
|
227
246
|
|
228
|
-
|
247
|
+
Fixes a case when modifying an implicitly rendered template for a
|
248
|
+
controller action using `fresh_when` or `stale?` would not result in a new
|
249
|
+
`ETag` value.
|
250
|
+
|
251
|
+
*Javan Makhmali*
|
229
252
|
|
230
253
|
* Make `fixture_file_upload` work in integration tests.
|
231
254
|
|
@@ -255,6 +278,18 @@
|
|
255
278
|
|
256
279
|
*Ryo Hashimoto*, *Andrew White*
|
257
280
|
|
281
|
+
* Include the content of the flash in the auto-generated etag. This solves the following problem:
|
282
|
+
|
283
|
+
1. POST /messages
|
284
|
+
2. redirect_to messages_url, notice: 'Message was created'
|
285
|
+
3. GET /messages/1
|
286
|
+
4. GET /messages
|
287
|
+
|
288
|
+
Step 4 would before still include the flash message, even though it's no longer relevant,
|
289
|
+
because the etag cache was recorded with the flash in place and didn't change when it was gone.
|
290
|
+
|
291
|
+
*DHH*
|
292
|
+
|
258
293
|
* SSL: Changes redirect behavior for all non-GET and non-HEAD requests
|
259
294
|
(like POST/PUT/PATCH etc) to `http://` resources to redirect to `https://`
|
260
295
|
with a [307 status code](http://tools.ietf.org/html/rfc7231#section-6.4.7) instead of [301 status code](http://tools.ietf.org/html/rfc7231#section-6.4.2).
|
@@ -273,7 +308,7 @@
|
|
273
308
|
redirects to
|
274
309
|
POST https://example.com/articles (i.e. ArticlesContoller#create)
|
275
310
|
|
276
|
-
|
311
|
+
*Chirag Singhal*
|
277
312
|
|
278
313
|
* Add `:as` option to `ActionController:TestCase#process` and related methods.
|
279
314
|
|
@@ -282,26 +317,40 @@
|
|
282
317
|
|
283
318
|
*Everest Stefan Munro-Zeisberger*
|
284
319
|
|
285
|
-
*
|
320
|
+
* Show cache hits and misses when rendering partials.
|
286
321
|
|
287
|
-
|
322
|
+
Partials using the `cache` helper will show whether a render hit or missed
|
323
|
+
the cache:
|
288
324
|
|
289
|
-
|
325
|
+
```
|
326
|
+
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
|
327
|
+
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
|
328
|
+
```
|
290
329
|
|
291
|
-
|
330
|
+
This removes the need for the old fragment cache logging:
|
292
331
|
|
293
|
-
|
332
|
+
```
|
333
|
+
Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms)
|
334
|
+
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
|
335
|
+
Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms)
|
336
|
+
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
|
337
|
+
```
|
294
338
|
|
295
|
-
|
339
|
+
Though that full output can be reenabled with
|
340
|
+
`config.action_controller.enable_fragment_cache_logging = true`.
|
296
341
|
|
297
|
-
|
342
|
+
*Stan Lo*
|
298
343
|
|
299
|
-
|
344
|
+
* Don't override the `Accept` header in integration tests when called with `xhr: true`.
|
345
|
+
|
346
|
+
Fixes #25859.
|
300
347
|
|
301
|
-
*
|
348
|
+
*David Chen*
|
349
|
+
|
350
|
+
* Fix `defaults` option for root route.
|
302
351
|
|
303
352
|
A regression from some refactoring for the 5.0 release, this change
|
304
|
-
fixes the use of
|
353
|
+
fixes the use of `defaults` (default parameters) in the `root` routing method.
|
305
354
|
|
306
355
|
*Chris Arcand*
|
307
356
|
|
@@ -315,882 +364,20 @@
|
|
315
364
|
|
316
365
|
*Grey Baker*
|
317
366
|
|
318
|
-
* Don't raise ActionController::UnknownHttpMethod from ActionDispatch::Static
|
367
|
+
* Don't raise `ActionController::UnknownHttpMethod` from `ActionDispatch::Static`.
|
319
368
|
|
320
369
|
Pass `Rack::Request` objects to `ActionDispatch::FileHandler` to avoid it
|
321
370
|
raising `ActionController::UnknownHttpMethod`. If an unknown method is
|
322
|
-
passed, it should exception higher in the stack instead, once we've had a
|
371
|
+
passed, it should pass exception higher in the stack instead, once we've had a
|
323
372
|
chance to define exception handling behaviour.
|
324
373
|
|
325
374
|
*Grey Baker*
|
326
375
|
|
327
|
-
* Handle `Rack::QueryParser` errors in `ActionDispatch::ExceptionWrapper
|
376
|
+
* Handle `Rack::QueryParser` errors in `ActionDispatch::ExceptionWrapper`.
|
328
377
|
|
329
378
|
Updated `ActionDispatch::ExceptionWrapper` to handle the Rack 2.0 namespace
|
330
379
|
for `ParameterTypeError` and `InvalidParameterError` errors.
|
331
380
|
|
332
381
|
*Grey Baker*
|
333
382
|
|
334
|
-
|
335
|
-
Specify the path with a String or a Symbol instead.
|
336
|
-
|
337
|
-
# Before
|
338
|
-
get action: :show, as: :show
|
339
|
-
# After
|
340
|
-
get "", action: :show, as: :show
|
341
|
-
|
342
|
-
*Volmer*
|
343
|
-
|
344
|
-
* Added new `ActionDispatch::DebugLocks` middleware that can be used
|
345
|
-
to diagnose deadlocks in the autoload interlock.
|
346
|
-
To use it, insert it near the top of the middleware stack, using
|
347
|
-
`config/application.rb`:
|
348
|
-
|
349
|
-
config.middleware.insert_before Rack::Sendfile, ActionDispatch::DebugLocks
|
350
|
-
|
351
|
-
After adding, visiting `/rails/locks` will show a summary of all
|
352
|
-
threads currently known to the interlock.
|
353
|
-
|
354
|
-
*Matthew Draper*
|
355
|
-
|
356
|
-
* Fix request encoding in Integration tests when string literals are
|
357
|
-
frozen using `--enable-frozen-string-literal` or `# frozen_string_literal: true`.
|
358
|
-
|
359
|
-
*Volmer*
|
360
|
-
|
361
|
-
* Since long keys are truncated when passed to ciphers, Ruby 2.4
|
362
|
-
doesn't accept keys greater than their max length.
|
363
|
-
Fixed default key length on cipher for `ActiveSupport::MessageEncryptor`,
|
364
|
-
which was causing errors on Ruby 2.4.
|
365
|
-
|
366
|
-
*Vipul A M*
|
367
|
-
|
368
|
-
* Fixed adding implicitly rendered template digests to ETags.
|
369
|
-
Properly ignore implicit template cache option to ETag, if `template: false`
|
370
|
-
is passed when rendering.
|
371
|
-
|
372
|
-
*Javan Makhmali*
|
373
|
-
|
374
|
-
|
375
|
-
## Rails 5.0.0 (June 30, 2016) ##
|
376
|
-
|
377
|
-
* Add `ActionController#helpers` to get access to the view context at the controller
|
378
|
-
level.
|
379
|
-
|
380
|
-
*Rafael Mendonça França*
|
381
|
-
|
382
|
-
* Routing: Refactor `:action` default handling to ensure that path
|
383
|
-
parameters are not mutated during route generation.
|
384
|
-
|
385
|
-
*Andrew White*
|
386
|
-
|
387
|
-
* Add extension synonyms `yml` and `yaml` for MIME type `application/x-yaml`.
|
388
|
-
|
389
|
-
*bogdanvlviv*
|
390
|
-
|
391
|
-
* Adds support for including ActionController::Cookies in API controllers.
|
392
|
-
Previously, including the module would raise when trying to define
|
393
|
-
a `cookies` helper method. Skip calling #helper_method if it is not
|
394
|
-
defined -- if we don't have helpers, we needn't define one.
|
395
|
-
|
396
|
-
Fixes #24304
|
397
|
-
|
398
|
-
*Ryan T. Hosford*
|
399
|
-
|
400
|
-
* ETags: Introduce `Response#strong_etag=` and `#weak_etag=` and analogous
|
401
|
-
options for `fresh_when` and `stale?`. `Response#etag=` sets a weak ETag.
|
402
|
-
|
403
|
-
Strong ETags are desirable when you're serving byte-for-byte identical
|
404
|
-
responses that support Range requests, like PDFs or videos (typically
|
405
|
-
done by reproxying the response from a backend storage service).
|
406
|
-
Also desirable when fronted by some CDNs that support strong ETags
|
407
|
-
only, like Akamai.
|
408
|
-
|
409
|
-
*Jeremy Daer*
|
410
|
-
|
411
|
-
* ETags: No longer strips quotes (") from ETag values before comparing them.
|
412
|
-
Quotes are significant, part of the ETag. A quoted ETag and an unquoted
|
413
|
-
one are not the same entity.
|
414
|
-
|
415
|
-
*Jeremy Daer*
|
416
|
-
|
417
|
-
* ETags: Support `If-None-Match: *`. Rarely useful for GET requests; meant
|
418
|
-
to provide some optimistic concurrency control for PUT requests.
|
419
|
-
|
420
|
-
*Jeremy Daer*
|
421
|
-
|
422
|
-
* `ActionDispatch::ParamsParser` is deprecated and was removed from the middleware
|
423
|
-
stack. To configure the parameter parsers use `ActionDispatch::Request.parameter_parsers=`.
|
424
|
-
|
425
|
-
*tenderlove*
|
426
|
-
|
427
|
-
* When a `respond_to` collector with a block doesn't have a response, then
|
428
|
-
a `:no_content` response should be rendered. This brings the default
|
429
|
-
rendering behavior introduced by https://github.com/rails/rails/issues/19036
|
430
|
-
to controller methods employing `respond_to`.
|
431
|
-
|
432
|
-
*Justin Coyne*
|
433
|
-
|
434
|
-
* Add `ActionController::Parameters#dig` on Ruby 2.3 and greater, which
|
435
|
-
behaves the same as `Hash#dig`.
|
436
|
-
|
437
|
-
*Sean Griffin*
|
438
|
-
|
439
|
-
* Add request headers in the payload of the `start_processing.action_controller`
|
440
|
-
and `process_action.action_controller` notifications.
|
441
|
-
|
442
|
-
*Gareth du Plooy*
|
443
|
-
|
444
|
-
* Add `action_dispatch_integration_test` load hook. The hook can be used to
|
445
|
-
extend `ActionDispatch::IntegrationTest` once it has been loaded.
|
446
|
-
|
447
|
-
*Yuichiro Kaneko*
|
448
|
-
|
449
|
-
* Update default rendering policies when the controller action did
|
450
|
-
not explicitly indicate a response.
|
451
|
-
|
452
|
-
For API controllers, the implicit render always renders "204 No Content"
|
453
|
-
and does not account for any templates.
|
454
|
-
|
455
|
-
For other controllers, the following conditions are checked:
|
456
|
-
|
457
|
-
First, if a template exists for the controller action, it is rendered.
|
458
|
-
This template lookup takes into account the action name, locales, format,
|
459
|
-
variant, template handlers, etc. (see `render` for details).
|
460
|
-
|
461
|
-
Second, if other templates exist for the controller action but is not in
|
462
|
-
the right format (or variant, etc.), an `ActionController::UnknownFormat`
|
463
|
-
is raised. The list of available templates is assumed to be a complete
|
464
|
-
enumeration of all the possible formats (or variants, etc.); that is,
|
465
|
-
having only HTML and JSON templates indicate that the controller action is
|
466
|
-
not meant to handle XML requests.
|
467
|
-
|
468
|
-
Third, if the current request is an "interactive" browser request (the user
|
469
|
-
navigated here by entering the URL in the address bar, submitting a form,
|
470
|
-
clicking on a link, etc. as opposed to an XHR or non-browser API request),
|
471
|
-
`ActionView::UnknownFormat` is raised to display a helpful error
|
472
|
-
message.
|
473
|
-
|
474
|
-
Finally, it falls back to the same "204 No Content" behavior as API controllers.
|
475
|
-
|
476
|
-
*Godfrey Chan*, *Jon Moss*, *Kasper Timm Hansen*, *Mike Clark*, *Matthew Draper*
|
477
|
-
|
478
|
-
* Add "application/gzip" as a default mime type.
|
479
|
-
|
480
|
-
*Mehmet Emin İNAÇ*
|
481
|
-
|
482
|
-
* Add request encoding and response parsing to integration tests.
|
483
|
-
|
484
|
-
What previously was:
|
485
|
-
|
486
|
-
```ruby
|
487
|
-
require 'test_helper'
|
488
|
-
|
489
|
-
class ApiTest < ActionDispatch::IntegrationTest
|
490
|
-
test 'creates articles' do
|
491
|
-
assert_difference -> { Article.count } do
|
492
|
-
post articles_path(format: :json),
|
493
|
-
params: { article: { title: 'Ahoy!' } }.to_json,
|
494
|
-
headers: { 'Content-Type' => 'application/json' }
|
495
|
-
end
|
496
|
-
|
497
|
-
assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, JSON.parse(response.body))
|
498
|
-
end
|
499
|
-
end
|
500
|
-
```
|
501
|
-
|
502
|
-
Can now be written as:
|
503
|
-
|
504
|
-
```ruby
|
505
|
-
require 'test_helper'
|
506
|
-
|
507
|
-
class ApiTest < ActionDispatch::IntegrationTest
|
508
|
-
test 'creates articles' do
|
509
|
-
assert_difference -> { Article.count } do
|
510
|
-
post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
|
511
|
-
end
|
512
|
-
|
513
|
-
assert_equal({ 'id' => Article.last.id, 'title' => 'Ahoy!' }, response.parsed_body)
|
514
|
-
end
|
515
|
-
end
|
516
|
-
```
|
517
|
-
|
518
|
-
Passing `as: :json` to integration test request helpers will set the format,
|
519
|
-
content type and encode the parameters as JSON.
|
520
|
-
|
521
|
-
Then on the response side, `parsed_body` will parse the body according to the
|
522
|
-
content type the response has.
|
523
|
-
|
524
|
-
Currently JSON is the only supported MIME type. Add your own with
|
525
|
-
`ActionDispatch::IntegrationTest.register_encoder`.
|
526
|
-
|
527
|
-
*Kasper Timm Hansen*
|
528
|
-
|
529
|
-
* Add "image/svg+xml" as a default mime type.
|
530
|
-
|
531
|
-
*DHH*
|
532
|
-
|
533
|
-
* Add `-g` and `-c` options to `bin/rails routes`. These options return the url `name`, `verb` and
|
534
|
-
`path` field that match the pattern or match a specific controller.
|
535
|
-
|
536
|
-
Deprecate `CONTROLLER` env variable in `bin/rails routes`.
|
537
|
-
|
538
|
-
See #18902.
|
539
|
-
|
540
|
-
*Anton Davydov*, *Vipul A M*
|
541
|
-
|
542
|
-
* Response etags to always be weak: Prefixes 'W/' to value returned by
|
543
|
-
`ActionDispatch::Http::Cache::Response#etag=`, such that etags set in
|
544
|
-
`fresh_when` and `stale?` are weak.
|
545
|
-
|
546
|
-
Fixes #17556.
|
547
|
-
|
548
|
-
*Abhishek Yadav*
|
549
|
-
|
550
|
-
* Provide the name of HTTP Status code in assertions.
|
551
|
-
|
552
|
-
*Sean Collins*
|
553
|
-
|
554
|
-
* More explicit error message when running `rake routes`. `CONTROLLER` argument
|
555
|
-
can now be supplied in different ways:
|
556
|
-
`Rails::WelcomeController`, `Rails::Welcome`, `rails/welcome`.
|
557
|
-
|
558
|
-
Fixes #22918.
|
559
|
-
|
560
|
-
*Edouard Chin*
|
561
|
-
|
562
|
-
* Allow `ActionController::Parameters` instances as an argument to URL
|
563
|
-
helper methods. An `ArgumentError` will be raised if the passed parameters
|
564
|
-
are not secure.
|
565
|
-
|
566
|
-
Fixes #22832.
|
567
|
-
|
568
|
-
*Prathamesh Sonpatki*
|
569
|
-
|
570
|
-
* Add option for per-form CSRF tokens.
|
571
|
-
|
572
|
-
*Greg Ose*, *Ben Toews*
|
573
|
-
|
574
|
-
* Fix `ActionController::Parameters#convert_parameters_to_hashes` to return filtered
|
575
|
-
or unfiltered values based on from where it is called, `to_h` or `to_unsafe_h`
|
576
|
-
respectively.
|
577
|
-
|
578
|
-
Fixes #22841.
|
579
|
-
|
580
|
-
*Prathamesh Sonpatki*
|
581
|
-
|
582
|
-
* Add `ActionController::Parameters#include?`
|
583
|
-
|
584
|
-
*Justin Coyne*
|
585
|
-
|
586
|
-
* Deprecate `redirect_to :back` in favor of `redirect_back`, which accepts a
|
587
|
-
required `fallback_location` argument, thus eliminating the possibility of a
|
588
|
-
`RedirectBackError`.
|
589
|
-
|
590
|
-
*Derek Prior*
|
591
|
-
|
592
|
-
* Add `redirect_back` method to `ActionController::Redirecting` to provide a
|
593
|
-
way to safely redirect to the `HTTP_REFERER` if it is present, falling back
|
594
|
-
to a provided redirect otherwise.
|
595
|
-
|
596
|
-
*Derek Prior*
|
597
|
-
|
598
|
-
* `ActionController::TestCase` will be moved to its own gem in Rails 5.1.
|
599
|
-
|
600
|
-
With the speed improvements made to `ActionDispatch::IntegrationTest` we no
|
601
|
-
longer need to keep two separate code bases for testing controllers. In
|
602
|
-
Rails 5.1 `ActionController::TestCase` will be deprecated and moved into a
|
603
|
-
gem outside of Rails source.
|
604
|
-
|
605
|
-
This is a documentation deprecation so that going forward new tests will use
|
606
|
-
`ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.
|
607
|
-
|
608
|
-
*Eileen M. Uchitelle*
|
609
|
-
|
610
|
-
* Add a `response_format` option to `ActionDispatch::DebugExceptions`
|
611
|
-
to configure the format of the response when errors occur in
|
612
|
-
development mode.
|
613
|
-
|
614
|
-
If `response_format` is `:default` the debug info will be rendered
|
615
|
-
in an HTML page. In the other hand, if the provided value is `:api`
|
616
|
-
the debug info will be rendered in the original response format.
|
617
|
-
|
618
|
-
*Jorge Bejar*
|
619
|
-
|
620
|
-
* Change the `protect_from_forgery` prepend default to `false`.
|
621
|
-
|
622
|
-
Per this comment
|
623
|
-
https://github.com/rails/rails/pull/18334#issuecomment-69234050 we want
|
624
|
-
`protect_from_forgery` to default to `prepend: false`.
|
625
|
-
|
626
|
-
`protect_from_forgery` will now be inserted into the callback chain at the
|
627
|
-
point it is called in your application. This is useful for cases where you
|
628
|
-
want to `protect_from_forgery` after you perform required authentication
|
629
|
-
callbacks or other callbacks that are required to run after forgery protection.
|
630
|
-
|
631
|
-
If you want `protect_from_forgery` callbacks to always run first, regardless of
|
632
|
-
position they are called in your application then you can add `prepend: true`
|
633
|
-
to your `protect_from_forgery` call.
|
634
|
-
|
635
|
-
Example:
|
636
|
-
|
637
|
-
```ruby
|
638
|
-
protect_from_forgery prepend: true
|
639
|
-
```
|
640
|
-
|
641
|
-
*Eileen M. Uchitelle*
|
642
|
-
|
643
|
-
* In url_for, never append a question mark to the URL when the query string
|
644
|
-
is empty anyway. (It used to do that when called like `url_for(controller:
|
645
|
-
'x', action: 'y', q: {})`.)
|
646
|
-
|
647
|
-
*Paul Grayson*
|
648
|
-
|
649
|
-
* Catch invalid UTF-8 querystring values and respond with BadRequest
|
650
|
-
|
651
|
-
Check querystring params for invalid UTF-8 characters, and raise an
|
652
|
-
ActionController::BadRequest error if present. Previously these strings
|
653
|
-
would typically trigger errors further down the stack.
|
654
|
-
|
655
|
-
*Grey Baker*
|
656
|
-
|
657
|
-
* Parse RSS/ATOM responses as XML, not HTML.
|
658
|
-
|
659
|
-
*Alexander Kaupanin*
|
660
|
-
|
661
|
-
* Show helpful message in `BadRequest` exceptions due to invalid path
|
662
|
-
parameter encodings.
|
663
|
-
|
664
|
-
Fixes #21923.
|
665
|
-
|
666
|
-
*Agis Anastasopoulos*
|
667
|
-
|
668
|
-
* Add the ability of returning arbitrary headers to `ActionDispatch::Static`.
|
669
|
-
|
670
|
-
Now ActionDispatch::Static can accept HTTP headers so that developers
|
671
|
-
will have control of returning arbitrary headers like
|
672
|
-
'Access-Control-Allow-Origin' when a response is delivered. They can be
|
673
|
-
configured with `#config`:
|
674
|
-
|
675
|
-
Example:
|
676
|
-
|
677
|
-
config.public_file_server.headers = {
|
678
|
-
"Cache-Control" => "public, max-age=60",
|
679
|
-
"Access-Control-Allow-Origin" => "http://rubyonrails.org"
|
680
|
-
}
|
681
|
-
|
682
|
-
*Yuki Nishijima*
|
683
|
-
|
684
|
-
* Allow multiple `root` routes in same scope level. Example:
|
685
|
-
|
686
|
-
Example:
|
687
|
-
|
688
|
-
root 'blog#show', constraints: ->(req) { Hostname.blog_site?(req.host) }
|
689
|
-
root 'landing#show'
|
690
|
-
|
691
|
-
*Rafael Sales*
|
692
|
-
|
693
|
-
* Fix regression in mounted engine named routes generation for app deployed to
|
694
|
-
a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
|
695
|
-
"/subdir/subdir/engine_path" instead of "/subdir/engine_path")
|
696
|
-
|
697
|
-
Fixes #20920. Fixes #21459.
|
698
|
-
|
699
|
-
*Matthew Erhard*
|
700
|
-
|
701
|
-
* `ActionDispatch::Response#new` no longer applies default headers. If you want
|
702
|
-
default headers applied to the response object, then call
|
703
|
-
`ActionDispatch::Response.create`. This change only impacts people who are
|
704
|
-
directly constructing an `ActionDispatch::Response` object.
|
705
|
-
|
706
|
-
* Accessing mime types via constants like `Mime::HTML` is deprecated. Please
|
707
|
-
change code like this:
|
708
|
-
|
709
|
-
Mime::HTML
|
710
|
-
|
711
|
-
To this:
|
712
|
-
|
713
|
-
Mime[:html]
|
714
|
-
|
715
|
-
This change is so that Rails will not manage a list of constants, and fixes
|
716
|
-
an issue where if a type isn't registered you could possibly get the wrong
|
717
|
-
object.
|
718
|
-
|
719
|
-
`Mime[:html]` is available in older versions of Rails, too, so you can
|
720
|
-
safely change libraries and plugins and maintain compatibility with
|
721
|
-
multiple versions of Rails.
|
722
|
-
|
723
|
-
* `url_for` does not modify its arguments when generating polymorphic URLs.
|
724
|
-
|
725
|
-
*Bernerd Schaefer*
|
726
|
-
|
727
|
-
* Make it easier to opt in to `config.force_ssl` and `config.ssl_options` by
|
728
|
-
making them less dangerous to try and easier to disable.
|
729
|
-
|
730
|
-
SSL redirect:
|
731
|
-
* Move `:host` and `:port` options within `redirect: { … }`. Deprecate.
|
732
|
-
* Introduce `:status` and `:body` to customize the redirect response.
|
733
|
-
The 301 permanent default makes it difficult to test the redirect and
|
734
|
-
back out of it since browsers remember the 301. Test with a 302 or 307
|
735
|
-
instead, then switch to 301 once you're confident that all is well.
|
736
|
-
|
737
|
-
HTTP Strict Transport Security (HSTS):
|
738
|
-
* Shorter max-age. Shorten the default max-age from 1 year to 180 days,
|
739
|
-
the low end for https://www.ssllabs.com/ssltest/ grading and greater
|
740
|
-
than the 18-week minimum to qualify for browser preload lists.
|
741
|
-
* Disabling HSTS. Setting `hsts: false` now sets `hsts { expires: 0 }`
|
742
|
-
instead of omitting the header. Omitting does nothing to disable HSTS
|
743
|
-
since browsers hang on to your previous settings until they expire.
|
744
|
-
Sending `{ hsts: { expires: 0 }}` flushes out old browser settings and
|
745
|
-
actually disables HSTS:
|
746
|
-
http://tools.ietf.org/html/rfc6797#section-6.1.1
|
747
|
-
* HSTS Preload. Introduce `preload: true` to set the `preload` flag,
|
748
|
-
indicating that your site may be included in browser preload lists,
|
749
|
-
including Chrome, Firefox, Safari, IE11, and Edge. Submit your site:
|
750
|
-
https://hstspreload.appspot.com
|
751
|
-
|
752
|
-
*Jeremy Daer*
|
753
|
-
|
754
|
-
* Update `ActionController::TestSession#fetch` to behave more like
|
755
|
-
`ActionDispatch::Request::Session#fetch` when using non-string keys.
|
756
|
-
|
757
|
-
*Jeremy Friesen*
|
758
|
-
|
759
|
-
* Using strings or symbols for middleware class names is deprecated. Convert
|
760
|
-
things like this:
|
761
|
-
|
762
|
-
middleware.use "Foo::Bar"
|
763
|
-
|
764
|
-
to this:
|
765
|
-
|
766
|
-
middleware.use Foo::Bar
|
767
|
-
|
768
|
-
* `ActionController::TestSession` now accepts a default value as well as
|
769
|
-
a block for generating a default value based off the key provided.
|
770
|
-
|
771
|
-
This fixes calls to `session#fetch` in `ApplicationController` instances that
|
772
|
-
take more two arguments or a block from raising `ArgumentError: wrong
|
773
|
-
number of arguments (2 for 1)` when performing controller tests.
|
774
|
-
|
775
|
-
*Matthew Gerrior*
|
776
|
-
|
777
|
-
* Fix `ActionController::Parameters#fetch` overwriting `KeyError` returned by
|
778
|
-
default block.
|
779
|
-
|
780
|
-
*Jonas Schuber Erlandsson*, *Roque Pinel*
|
781
|
-
|
782
|
-
* `ActionController::Parameters` no longer inherits from
|
783
|
-
`HashWithIndifferentAccess`
|
784
|
-
|
785
|
-
Inheriting from `HashWithIndifferentAccess` allowed users to call any
|
786
|
-
enumerable methods on `Parameters` object, resulting in a risk of losing the
|
787
|
-
`permitted?` status or even getting back a pure `Hash` object instead of
|
788
|
-
a `Parameters` object with proper sanitization.
|
789
|
-
|
790
|
-
By not inheriting from `HashWithIndifferentAccess`, we are able to make
|
791
|
-
sure that all methods that are defined in `Parameters` object will return
|
792
|
-
a proper `Parameters` object with a correct `permitted?` flag.
|
793
|
-
|
794
|
-
*Prem Sichanugrist*
|
795
|
-
|
796
|
-
* Replaced `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`
|
797
|
-
from the concurrent-ruby gem.
|
798
|
-
|
799
|
-
*Jerry D'Antonio*
|
800
|
-
|
801
|
-
* Add ability to filter parameters based on parent keys.
|
802
|
-
|
803
|
-
# matches {credit_card: {code: "xxxx"}}
|
804
|
-
# doesn't match {file: { code: "xxxx"}}
|
805
|
-
config.filter_parameters += [ "credit_card.code" ]
|
806
|
-
|
807
|
-
See #13897.
|
808
|
-
|
809
|
-
*Guillaume Malette*
|
810
|
-
|
811
|
-
* Deprecate passing first parameter as `Hash` and default status code for `head` method.
|
812
|
-
|
813
|
-
*Mehmet Emin İNAÇ*
|
814
|
-
|
815
|
-
* Adds`Rack::Utils::ParameterTypeError` and `Rack::Utils::InvalidParameterError`
|
816
|
-
to the rescue_responses hash in `ExceptionWrapper` (Rack recommends
|
817
|
-
integrators serve 400s for both of these).
|
818
|
-
|
819
|
-
*Grey Baker*
|
820
|
-
|
821
|
-
* Add support for API only apps.
|
822
|
-
`ActionController::API` is added as a replacement of
|
823
|
-
`ActionController::Base` for this kind of applications.
|
824
|
-
|
825
|
-
*Santiago Pastorino*, *Jorge Bejar*
|
826
|
-
|
827
|
-
* Remove `assigns` and `assert_template`. Both methods have been extracted
|
828
|
-
into a gem at https://github.com/rails/rails-controller-testing.
|
829
|
-
|
830
|
-
See #18950.
|
831
|
-
|
832
|
-
*Alan Guo Xiang Tan*
|
833
|
-
|
834
|
-
* `FileHandler` and `Static` middleware initializers accept `index` argument
|
835
|
-
to configure the directory index file name. Defaults to `index` (as in
|
836
|
-
`index.html`).
|
837
|
-
|
838
|
-
See #20017.
|
839
|
-
|
840
|
-
*Eliot Sykes*
|
841
|
-
|
842
|
-
* Deprecate `:nothing` option for `render` method.
|
843
|
-
|
844
|
-
*Mehmet Emin İNAÇ*
|
845
|
-
|
846
|
-
* Fix `rake routes` not showing the right format when
|
847
|
-
nesting multiple routes.
|
848
|
-
|
849
|
-
See #18373.
|
850
|
-
|
851
|
-
*Ravil Bayramgalin*
|
852
|
-
|
853
|
-
* Add ability to override default form builder for a controller.
|
854
|
-
|
855
|
-
class AdminController < ApplicationController
|
856
|
-
default_form_builder AdminFormBuilder
|
857
|
-
end
|
858
|
-
|
859
|
-
*Kevin McPhillips*
|
860
|
-
|
861
|
-
* For actions with no corresponding templates, render `head :no_content`
|
862
|
-
instead of raising an error. This allows for slimmer API controller
|
863
|
-
methods that simply work, without needing further instructions.
|
864
|
-
|
865
|
-
See #19036.
|
866
|
-
|
867
|
-
*Stephen Bussey*
|
868
|
-
|
869
|
-
* Provide friendlier access to request variants.
|
870
|
-
|
871
|
-
request.variant = :phone
|
872
|
-
request.variant.phone? # true
|
873
|
-
request.variant.tablet? # false
|
874
|
-
|
875
|
-
request.variant = [:phone, :tablet]
|
876
|
-
request.variant.phone? # true
|
877
|
-
request.variant.desktop? # false
|
878
|
-
request.variant.any?(:phone, :desktop) # true
|
879
|
-
request.variant.any?(:desktop, :watch) # false
|
880
|
-
|
881
|
-
*George Claghorn*
|
882
|
-
|
883
|
-
* Fix regression where a gzip file response would have a Content-type,
|
884
|
-
even when it was a 304 status code.
|
885
|
-
|
886
|
-
See #19271.
|
887
|
-
|
888
|
-
*Kohei Suzuki*
|
889
|
-
|
890
|
-
* Fix handling of empty `X_FORWARDED_HOST` header in `raw_host_with_port`.
|
891
|
-
|
892
|
-
Previously, an empty `X_FORWARDED_HOST` header would cause
|
893
|
-
`Actiondispatch::Http:URL.raw_host_with_port` to return `nil`, causing
|
894
|
-
`Actiondispatch::Http:URL.host` to raise a `NoMethodError`.
|
895
|
-
|
896
|
-
*Adam Forsyth*
|
897
|
-
|
898
|
-
* Allow `Bearer` as token-keyword in `Authorization-Header`.
|
899
|
-
|
900
|
-
Additionally to `Token`, the keyword `Bearer` is acceptable as a keyword
|
901
|
-
for the auth-token. The `Bearer` keyword is described in the original
|
902
|
-
OAuth RFC and used in libraries like Angular-JWT.
|
903
|
-
|
904
|
-
See #19094.
|
905
|
-
|
906
|
-
*Peter Schröder*
|
907
|
-
|
908
|
-
* Drop request class from `RouteSet` constructor.
|
909
|
-
|
910
|
-
If you would like to use a custom request class, please subclass and implement
|
911
|
-
the `request_class` method.
|
912
|
-
|
913
|
-
*tenderlove@ruby-lang.org*
|
914
|
-
|
915
|
-
* Fallback to `ENV['RAILS_RELATIVE_URL_ROOT']` in `url_for`.
|
916
|
-
|
917
|
-
Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not
|
918
|
-
prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
|
919
|
-
is set, it takes precedence.
|
920
|
-
|
921
|
-
Fixes #5122.
|
922
|
-
|
923
|
-
*Yasyf Mohamedali*
|
924
|
-
|
925
|
-
* Partitioning of routes is now done when the routes are being drawn. This
|
926
|
-
helps to decrease the time spent filtering the routes during the first request.
|
927
|
-
|
928
|
-
*Guo Xiang Tan*
|
929
|
-
|
930
|
-
* Fix regression in functional tests. Responses should have default headers
|
931
|
-
assigned.
|
932
|
-
|
933
|
-
See #18423.
|
934
|
-
|
935
|
-
*Jeremy Kemper*, *Yves Senn*
|
936
|
-
|
937
|
-
* Deprecate `AbstractController#skip_action_callback` in favor of individual skip_callback methods
|
938
|
-
(which can be made to raise an error if no callback was removed).
|
939
|
-
|
940
|
-
*Iain Beeston*
|
941
|
-
|
942
|
-
* Alias the `ActionDispatch::Request#uuid` method to `ActionDispatch::Request#request_id`.
|
943
|
-
Due to implementation, `config.log_tags = [:request_id]` also works in substitute
|
944
|
-
for `config.log_tags = [:uuid]`.
|
945
|
-
|
946
|
-
*David Ilizarov*
|
947
|
-
|
948
|
-
* Change filter on /rails/info/routes to use an actual path regexp from rails
|
949
|
-
and not approximate javascript version. Oniguruma supports much more
|
950
|
-
extensive list of features than javascript regexp engine.
|
951
|
-
|
952
|
-
Fixes #18402.
|
953
|
-
|
954
|
-
*Ravil Bayramgalin*
|
955
|
-
|
956
|
-
* Non-string authenticity tokens do not raise NoMethodError when decoding
|
957
|
-
the masked token.
|
958
|
-
|
959
|
-
*Ville Lautanala*
|
960
|
-
|
961
|
-
* Add `http_cache_forever` to Action Controller, so we can cache a response
|
962
|
-
that never gets expired.
|
963
|
-
|
964
|
-
*arthurnn*
|
965
|
-
|
966
|
-
* `ActionController#translate` supports symbols as shortcuts.
|
967
|
-
When a shortcut is given it also performs the lookup without the action
|
968
|
-
name.
|
969
|
-
|
970
|
-
*Max Melentiev*
|
971
|
-
|
972
|
-
* Expand `ActionController::ConditionalGet#fresh_when` and `stale?` to also
|
973
|
-
accept a collection of records as the first argument, so that the
|
974
|
-
following code can be written in a shorter form.
|
975
|
-
|
976
|
-
# Before
|
977
|
-
def index
|
978
|
-
@articles = Article.all
|
979
|
-
fresh_when(etag: @articles, last_modified: @articles.maximum(:updated_at))
|
980
|
-
end
|
981
|
-
|
982
|
-
# After
|
983
|
-
def index
|
984
|
-
@articles = Article.all
|
985
|
-
fresh_when(@articles)
|
986
|
-
end
|
987
|
-
|
988
|
-
*claudiob*
|
989
|
-
|
990
|
-
* Explicitly ignored wildcard verbs when searching for HEAD routes before fallback
|
991
|
-
|
992
|
-
Fixes an issue where a mounted rack app at root would intercept the HEAD
|
993
|
-
request causing an incorrect behavior during the fall back to GET requests.
|
994
|
-
|
995
|
-
Example:
|
996
|
-
|
997
|
-
draw do
|
998
|
-
get '/home' => 'test#index'
|
999
|
-
mount rack_app, at: '/'
|
1000
|
-
end
|
1001
|
-
head '/home'
|
1002
|
-
assert_response :success
|
1003
|
-
|
1004
|
-
In this case, a HEAD request runs through the routes the first time and fails
|
1005
|
-
to match anything. Then, it runs through the list with the fallback and matches
|
1006
|
-
`get '/home'`. The original behavior would match the rack app in the first pass.
|
1007
|
-
|
1008
|
-
*Terence Sun*
|
1009
|
-
|
1010
|
-
* Discarded flash messages get removed before storing into session.
|
1011
|
-
|
1012
|
-
*Samuel Cochran*
|
1013
|
-
|
1014
|
-
* Migrating xhr methods to keyword arguments syntax
|
1015
|
-
in `ActionController::TestCase` and `ActionDispatch::Integration`
|
1016
|
-
|
1017
|
-
Old syntax:
|
1018
|
-
|
1019
|
-
xhr :get, :create, params: { id: 1 }
|
1020
|
-
|
1021
|
-
New syntax example:
|
1022
|
-
|
1023
|
-
get :create, params: { id: 1 }, xhr: true
|
1024
|
-
|
1025
|
-
*Kir Shatrov*
|
1026
|
-
|
1027
|
-
* Migrating to keyword arguments syntax in `ActionController::TestCase` and
|
1028
|
-
`ActionDispatch::Integration` HTTP request methods.
|
1029
|
-
|
1030
|
-
Example:
|
1031
|
-
|
1032
|
-
post :create, params: { y: x }, session: { a: 'b' }
|
1033
|
-
get :view, params: { id: 1 }
|
1034
|
-
get :view, params: { id: 1 }, format: :json
|
1035
|
-
|
1036
|
-
*Kir Shatrov*
|
1037
|
-
|
1038
|
-
* Preserve default url options when generating URLs.
|
1039
|
-
|
1040
|
-
Fixes an issue that would cause `default_url_options` to be lost when
|
1041
|
-
generating URLs with fewer positional arguments than parameters in the
|
1042
|
-
route definition.
|
1043
|
-
|
1044
|
-
*Tekin Suleyman*
|
1045
|
-
|
1046
|
-
* Deprecate `*_via_redirect` integration test methods.
|
1047
|
-
|
1048
|
-
Use `follow_redirect!` manually after the request call for the same behavior.
|
1049
|
-
|
1050
|
-
*Aditya Kapoor*
|
1051
|
-
|
1052
|
-
* Add `ActionController::Renderer` to render arbitrary templates
|
1053
|
-
outside controller actions.
|
1054
|
-
|
1055
|
-
Its functionality is accessible through class methods `render` and
|
1056
|
-
`renderer` of `ActionController::Base`.
|
1057
|
-
|
1058
|
-
*Ravil Bayramgalin*
|
1059
|
-
|
1060
|
-
* Support `:assigns` option when rendering with controllers/mailers.
|
1061
|
-
|
1062
|
-
*Ravil Bayramgalin*
|
1063
|
-
|
1064
|
-
* Default headers, removed in controller actions, are no longer reapplied on
|
1065
|
-
the test response.
|
1066
|
-
|
1067
|
-
*Jonas Baumann*
|
1068
|
-
|
1069
|
-
* Deprecate all `*_filter` callbacks in favor of `*_action` callbacks.
|
1070
|
-
|
1071
|
-
*Rafael Mendonça França*
|
1072
|
-
|
1073
|
-
* Allow you to pass `prepend: false` to `protect_from_forgery` to have the
|
1074
|
-
verification callback appended instead of prepended to the chain.
|
1075
|
-
This allows you to let the verification step depend on prior callbacks.
|
1076
|
-
|
1077
|
-
Example:
|
1078
|
-
|
1079
|
-
class ApplicationController < ActionController::Base
|
1080
|
-
before_action :authenticate
|
1081
|
-
protect_from_forgery prepend: false, unless: -> { @authenticated_by.oauth? }
|
1082
|
-
|
1083
|
-
private
|
1084
|
-
def authenticate
|
1085
|
-
if oauth_request?
|
1086
|
-
# authenticate with oauth
|
1087
|
-
@authenticated_by = 'oauth'.inquiry
|
1088
|
-
else
|
1089
|
-
# authenticate with cookies
|
1090
|
-
@authenticated_by = 'cookie'.inquiry
|
1091
|
-
end
|
1092
|
-
end
|
1093
|
-
end
|
1094
|
-
|
1095
|
-
*Josef Šimánek*
|
1096
|
-
|
1097
|
-
* Remove `ActionController::HideActions`.
|
1098
|
-
|
1099
|
-
*Ravil Bayramgalin*
|
1100
|
-
|
1101
|
-
* Remove `respond_to`/`respond_with` placeholder methods, this functionality
|
1102
|
-
has been extracted to the `responders` gem.
|
1103
|
-
|
1104
|
-
*Carlos Antonio da Silva*
|
1105
|
-
|
1106
|
-
* Remove deprecated assertion files.
|
1107
|
-
|
1108
|
-
*Rafael Mendonça França*
|
1109
|
-
|
1110
|
-
* Remove deprecated usage of string keys in URL helpers.
|
1111
|
-
|
1112
|
-
*Rafael Mendonça França*
|
1113
|
-
|
1114
|
-
* Remove deprecated `only_path` option on `*_path` helpers.
|
1115
|
-
|
1116
|
-
*Rafael Mendonça França*
|
1117
|
-
|
1118
|
-
* Remove deprecated `NamedRouteCollection#helpers`.
|
1119
|
-
|
1120
|
-
*Rafael Mendonça França*
|
1121
|
-
|
1122
|
-
* Remove deprecated support to define routes with `:to` option that doesn't contain `#`.
|
1123
|
-
|
1124
|
-
*Rafael Mendonça França*
|
1125
|
-
|
1126
|
-
* Remove deprecated `ActionDispatch::Response#to_ary`.
|
1127
|
-
|
1128
|
-
*Rafael Mendonça França*
|
1129
|
-
|
1130
|
-
* Remove deprecated `ActionDispatch::Request#deep_munge`.
|
1131
|
-
|
1132
|
-
*Rafael Mendonça França*
|
1133
|
-
|
1134
|
-
* Remove deprecated `ActionDispatch::Http::Parameters#symbolized_path_parameters`.
|
1135
|
-
|
1136
|
-
*Rafael Mendonça França*
|
1137
|
-
|
1138
|
-
* Remove deprecated option `use_route` in controller tests.
|
1139
|
-
|
1140
|
-
*Rafael Mendonça França*
|
1141
|
-
|
1142
|
-
* Ensure `append_info_to_payload` is called even if an exception is raised.
|
1143
|
-
|
1144
|
-
Fixes an issue where when an exception is raised in the request the additional
|
1145
|
-
payload data is not available.
|
1146
|
-
|
1147
|
-
See #14903.
|
1148
|
-
|
1149
|
-
*Dieter Komendera*, *Margus Pärt*
|
1150
|
-
|
1151
|
-
* Correctly rely on the response's status code to handle calls to `head`.
|
1152
|
-
|
1153
|
-
*Robin Dupret*
|
1154
|
-
|
1155
|
-
* Using `head` method returns empty response_body instead
|
1156
|
-
of returning a single space " ".
|
1157
|
-
|
1158
|
-
The old behavior was added as a workaround for a bug in an early
|
1159
|
-
version of Safari, where the HTTP headers are not returned correctly
|
1160
|
-
if the response body has a 0-length. This is been fixed since and
|
1161
|
-
the workaround is no longer necessary.
|
1162
|
-
|
1163
|
-
Fixes #18253.
|
1164
|
-
|
1165
|
-
*Prathamesh Sonpatki*
|
1166
|
-
|
1167
|
-
* Fix how polymorphic routes works with objects that implement `to_model`.
|
1168
|
-
|
1169
|
-
*Travis Grathwell*
|
1170
|
-
|
1171
|
-
* Stop converting empty arrays in `params` to `nil`.
|
1172
|
-
|
1173
|
-
This behavior was introduced in response to CVE-2012-2660, CVE-2012-2694
|
1174
|
-
and CVE-2013-0155
|
1175
|
-
|
1176
|
-
ActiveRecord now issues a safe query when passing an empty array into
|
1177
|
-
a where clause, so there is no longer a need to defend against this type
|
1178
|
-
of input (any nils are still stripped from the array).
|
1179
|
-
|
1180
|
-
*Chris Sinjakli*
|
1181
|
-
|
1182
|
-
* Remove `ActionController::ModelNaming` module.
|
1183
|
-
|
1184
|
-
*claudiob*
|
1185
|
-
|
1186
|
-
* Fixed usage of optional scopes in url helpers.
|
1187
|
-
|
1188
|
-
*Alex Robbin*
|
1189
|
-
|
1190
|
-
* Fixed handling of positional url helper arguments when `format: false`.
|
1191
|
-
|
1192
|
-
Fixes #17819.
|
1193
|
-
|
1194
|
-
*Andrew White*, *Tatiana Soukiassian*
|
1195
|
-
|
1196
|
-
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/actionpack/CHANGELOG.md) for previous changes.
|
383
|
+
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/actionpack/CHANGELOG.md) for previous changes.
|