actionpack 6.0.0.beta3 → 6.0.0.rc1

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.

Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -2
  3. data/README.rdoc +2 -1
  4. data/lib/action_controller/metal.rb +2 -2
  5. data/lib/action_controller/metal/helpers.rb +1 -1
  6. data/lib/action_controller/metal/live.rb +1 -1
  7. data/lib/action_controller/metal/params_wrapper.rb +1 -1
  8. data/lib/action_controller/metal/request_forgery_protection.rb +1 -1
  9. data/lib/action_controller/metal/strong_parameters.rb +0 -4
  10. data/lib/action_controller/renderer.rb +2 -2
  11. data/lib/action_dispatch.rb +1 -0
  12. data/lib/action_dispatch/http/mime_type.rb +13 -1
  13. data/lib/action_dispatch/http/response.rb +3 -4
  14. data/lib/action_dispatch/journey/path/pattern.rb +6 -1
  15. data/lib/action_dispatch/journey/routes.rb +0 -1
  16. data/lib/action_dispatch/middleware/actionable_exceptions.rb +39 -0
  17. data/lib/action_dispatch/middleware/cookies.rb +1 -1
  18. data/lib/action_dispatch/middleware/debug_exceptions.rb +8 -2
  19. data/lib/action_dispatch/middleware/debug_view.rb +4 -0
  20. data/lib/action_dispatch/middleware/exception_wrapper.rb +1 -0
  21. data/lib/action_dispatch/middleware/public_exceptions.rb +6 -2
  22. data/lib/action_dispatch/middleware/stack.rb +24 -3
  23. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +13 -0
  24. data/lib/action_dispatch/middleware/templates/rescues/_actions.text.erb +0 -0
  25. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +5 -1
  26. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -0
  27. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +2 -0
  28. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +4 -0
  29. data/lib/action_dispatch/routing.rb +4 -4
  30. data/lib/action_dispatch/routing/mapper.rb +18 -4
  31. data/lib/action_dispatch/routing/route_set.rb +13 -15
  32. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +2 -1
  33. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +7 -5
  34. data/lib/action_dispatch/testing/request_encoder.rb +2 -2
  35. data/lib/action_pack/gem_version.rb +1 -1
  36. metadata +14 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5a16ad6b7bbc7a93fbbe113780c3d5ad6bf791facc02dbf7c708ce0aa3b12a2
4
- data.tar.gz: c09c775266bb80b7da86600aa3ecdf9db41a711210014e94cceadbd0db2e4569
3
+ metadata.gz: 2d2725f46356b4d4f8462ad40d29c435ed006f3c848b07488179d7d0046ad560
4
+ data.tar.gz: 9564e815a7a0f778a6f355016278d194926bcf081b30ff027168c1897f014a64
5
5
  SHA512:
6
- metadata.gz: 9b667c6f5ba393b3470643d1bc3025e8c6a1062c8052a6129fb495a282132868673f625eef15dd1dee772ef79027c7ab45c4ed0c5184078292f7a8edd54a7289
7
- data.tar.gz: 131617cc29ed16b18d06507eca871e1e8b199d913765123488205a0c4a5abb0916be4d6558677d28cb4b37963580f5be8a3597c966863d87fd4c5205c4484ed4
6
+ metadata.gz: f7fed7e925346ebe539b41e638f1ba3bf43d4276a20c392cad35901d179c07cc9933d662f473076a484225e4c8cf0e2a8023fad1fe261405c2dc5ab3f820787e
7
+ data.tar.gz: 2d3bb76a1215e66f9a55a450cb39723e8d370007787ef2550b001484e2056431a6eb2e564fb16cc6563475d342a5f5ba25a826183e58bacb89e65d1e70fc6b87
@@ -1,3 +1,38 @@
1
+ ## Rails 6.0.0.rc1 (April 24, 2019) ##
2
+
3
+ * Make system tests take a failed screenshot in a `before_teardown` hook
4
+ rather than an `after_teardown` hook.
5
+
6
+ This helps minimize the time gap between when an assertion fails and when
7
+ the screenshot is taken (reducing the time in which the page could have
8
+ been dynamically updated after the assertion failed).
9
+
10
+ *Richard Macklin*
11
+
12
+ * Introduce `ActionDispatch::ActionableExceptions`.
13
+
14
+ The `ActionDispatch::ActionableExceptions` middleware dispatches actions
15
+ from `ActiveSupport::ActionableError` descendants.
16
+
17
+ Actionable errors let's you dispatch actions from Rails' error pages.
18
+
19
+ *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
20
+
21
+ * Raise an `ArgumentError` if a resource custom param contains a colon (`:`).
22
+
23
+ After this change it's not possible anymore to configure routes like this:
24
+
25
+ ```
26
+ routes.draw do
27
+ resources :users, param: 'name/:sneaky'
28
+ end
29
+ ```
30
+
31
+ Fixes #30467.
32
+
33
+ *Josua Schmid*
34
+
35
+
1
36
  ## Rails 6.0.0.beta3 (March 11, 2019) ##
2
37
 
3
38
  * No changes.
@@ -28,7 +63,7 @@
28
63
 
29
64
  *Rafael Mendonça França*
30
65
 
31
- * Introduce ActionDispatch::HostAuthorization
66
+ * Introduce `ActionDispatch::HostAuthorization`.
32
67
 
33
68
  This is a new middleware that guards against DNS rebinding attacks by
34
69
  explicitly permitting the hosts a request can be made to.
@@ -58,7 +93,7 @@
58
93
 
59
94
  * Raise an error on root route naming conflicts.
60
95
 
61
- Raises an ArgumentError when multiple root routes are defined in the
96
+ Raises an `ArgumentError` when multiple root routes are defined in the
62
97
  same context instead of assigning nil names to subsequent roots.
63
98
 
64
99
  *Gannon McGibbon*
@@ -23,6 +23,7 @@ by default and Action View rendering is implicitly triggered by Action
23
23
  Controller. However, these modules are designed to function on their own and
24
24
  can be used outside of Rails.
25
25
 
26
+ You can read more about Action Pack in the {Action Controller Overview}[https://guides.rubyonrails.org/action_controller_overview.html] guide.
26
27
 
27
28
  == Download and installation
28
29
 
@@ -46,7 +47,7 @@ Action Pack is released under the MIT license:
46
47
 
47
48
  API documentation is at:
48
49
 
49
- * http://api.rubyonrails.org
50
+ * https://api.rubyonrails.org
50
51
 
51
52
  Bug reports for the Ruby on Rails project can be filed here:
52
53
 
@@ -26,10 +26,10 @@ module ActionController
26
26
  end
27
27
  end
28
28
 
29
- def build(action, app = Proc.new)
29
+ def build(action, app = nil, &block)
30
30
  action = action.to_s
31
31
 
32
- middlewares.reverse.inject(app) do |a, middleware|
32
+ middlewares.reverse.inject(app || block) do |a, middleware|
33
33
  middleware.valid?(action) ? middleware.build(a) : a
34
34
  end
35
35
  end
@@ -34,7 +34,7 @@ module ActionController
34
34
  # end
35
35
  # end
36
36
  #
37
- # Then, in any view rendered by <tt>EventController</tt>, the <tt>format_time</tt> method can be called:
37
+ # Then, in any view rendered by <tt>EventsController</tt>, the <tt>format_time</tt> method can be called:
38
38
  #
39
39
  # <% @events.each do |event| -%>
40
40
  # <p>
@@ -305,7 +305,7 @@ module ActionController
305
305
 
306
306
  logger.fatal do
307
307
  message = +"\n#{exception.class} (#{exception.message}):\n"
308
- message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
308
+ message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code)
309
309
  message << " " << exception.backtrace.join("\n ")
310
310
  "#{message}\n\n"
311
311
  end
@@ -93,7 +93,7 @@ module ActionController
93
93
  end
94
94
 
95
95
  def model
96
- super || synchronize { super || self.model = _default_wrap_model }
96
+ super || self.model = _default_wrap_model
97
97
  end
98
98
 
99
99
  def include
@@ -431,7 +431,7 @@ module ActionController #:nodoc:
431
431
  The browser returned a 'null' origin for a request with origin-based forgery protection turned on. This usually
432
432
  means you have the 'no-referrer' Referrer-Policy header enabled, or that the request came from a site that
433
433
  refused to give its origin. This makes it impossible for Rails to verify the source of the requests. Likely the
434
- best solution is to change your referrer policy to something less strict like same-origin or strict-same-origin.
434
+ best solution is to change your referrer policy to something less strict like same-origin or strict-origin.
435
435
  If you cannot change the referrer policy, you can disable origin checking with the
436
436
  Rails.application.config.action_controller.forgery_protection_origin_check setting.
437
437
  MSG
@@ -4,7 +4,6 @@ require "active_support/core_ext/hash/indifferent_access"
4
4
  require "active_support/core_ext/array/wrap"
5
5
  require "active_support/core_ext/string/filters"
6
6
  require "active_support/core_ext/object/to_query"
7
- require "active_support/rescuable"
8
7
  require "action_dispatch/http/upload"
9
8
  require "rack/test"
10
9
  require "stringio"
@@ -1092,9 +1091,6 @@ module ActionController
1092
1091
  # See ActionController::Parameters.require and ActionController::Parameters.permit
1093
1092
  # for more information.
1094
1093
  module StrongParameters
1095
- extend ActiveSupport::Concern
1096
- include ActiveSupport::Rescuable
1097
-
1098
1094
  # Returns a new ActionController::Parameters object that
1099
1095
  # has been instantiated with the <tt>request.parameters</tt>.
1100
1096
  def params
@@ -74,7 +74,7 @@ module ActionController
74
74
  # * <tt>:partial</tt> - See <tt>ActionView::PartialRenderer</tt> for details.
75
75
  # * <tt>:file</tt> - Renders an explicit template file. Add <tt>:locals</tt> to pass in, if so desired.
76
76
  # It shouldn’t be used directly with unsanitized user input due to lack of validation.
77
- # * <tt>:inline</tt> - Renders a ERB template string.
77
+ # * <tt>:inline</tt> - Renders an ERB template string.
78
78
  # * <tt>:plain</tt> - Renders provided text and sets the content type as <tt>text/plain</tt>.
79
79
  # * <tt>:html</tt> - Renders the provided HTML safe string, otherwise
80
80
  # performs HTML escape on the string first. Sets the content type as <tt>text/html</tt>.
@@ -116,7 +116,7 @@ module ActionController
116
116
 
117
117
  RACK_VALUE_TRANSLATION = {
118
118
  https: ->(v) { v ? "on" : "off" },
119
- method: ->(v) { v.upcase },
119
+ method: ->(v) { -v.upcase },
120
120
  }
121
121
 
122
122
  def rack_key_for(key)
@@ -53,6 +53,7 @@ module ActionDispatch
53
53
  autoload :RequestId
54
54
  autoload :Callbacks
55
55
  autoload :Cookies
56
+ autoload :ActionableExceptions
56
57
  autoload :DebugExceptions
57
58
  autoload :DebugLocks
58
59
  autoload :DebugView
@@ -170,6 +170,7 @@ module Mime
170
170
  def parse(accept_header)
171
171
  if !accept_header.include?(",")
172
172
  accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first
173
+ return [] unless accept_header
173
174
  parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact
174
175
  else
175
176
  list, index = [], 0
@@ -221,7 +222,18 @@ module Mime
221
222
 
222
223
  attr_reader :hash
223
224
 
225
+ MIME_NAME = "[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}"
226
+ MIME_PARAMETER_KEY = "[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}"
227
+ MIME_PARAMETER_VALUE = "#{Regexp.escape('"')}?[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}#{Regexp.escape('"')}?"
228
+ MIME_PARAMETER = "\s*\;\s+#{MIME_PARAMETER_KEY}(?:\=#{MIME_PARAMETER_VALUE})?"
229
+ MIME_REGEXP = /\A(?:\*\/\*|#{MIME_NAME}\/(?:\*|#{MIME_NAME})(?:\s*#{MIME_PARAMETER}\s*)*)\z/
230
+
231
+ class InvalidMimeType < StandardError; end
232
+
224
233
  def initialize(string, symbol = nil, synonyms = [])
234
+ unless MIME_REGEXP.match?(string)
235
+ raise InvalidMimeType, "#{string.inspect} is not a valid MIME type"
236
+ end
225
237
  @symbol, @synonyms = symbol, synonyms
226
238
  @string = string
227
239
  @hash = [@string, @synonyms, @symbol].hash
@@ -303,7 +315,7 @@ module Mime
303
315
  include Singleton
304
316
 
305
317
  def initialize
306
- super "*/*", :all
318
+ super "*/*", nil
307
319
  end
308
320
 
309
321
  def all?; true; end
@@ -82,6 +82,7 @@ module ActionDispatch # :nodoc:
82
82
  SET_COOKIE = "Set-Cookie"
83
83
  LOCATION = "Location"
84
84
  NO_CONTENT_CODES = [100, 101, 102, 204, 205, 304]
85
+ CONTENT_TYPE_PARSER = /\A(?<type>[^;\s]+)?(?:.*;\s*charset=(?<quote>"?)(?<charset>[^;\s]+)\k<quote>)?/ # :nodoc:
85
86
 
86
87
  cattr_accessor :default_charset, default: "utf-8"
87
88
  cattr_accessor :default_headers
@@ -409,10 +410,8 @@ module ActionDispatch # :nodoc:
409
410
  NullContentTypeHeader = ContentTypeHeader.new nil, nil
410
411
 
411
412
  def parse_content_type(content_type)
412
- if content_type
413
- type, charset = content_type.split(/;\s*charset=/)
414
- type = nil if type && type.empty?
415
- ContentTypeHeader.new(type, charset)
413
+ if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
414
+ ContentTypeHeader.new(match[:type], match[:charset])
416
415
  else
417
416
  NullContentTypeHeader
418
417
  end
@@ -119,7 +119,8 @@ module ActionDispatch
119
119
 
120
120
  class UnanchoredRegexp < AnchoredRegexp # :nodoc:
121
121
  def accept(node)
122
- %r{\A#{visit node}(?:\b|\Z)}
122
+ path = visit node
123
+ path == "/" ? %r{\A/} : %r{\A#{path}(?:\b|\Z|/)}
123
124
  end
124
125
  end
125
126
 
@@ -136,6 +137,10 @@ module ActionDispatch
136
137
  Array.new(length - 1) { |i| self[i + 1] }
137
138
  end
138
139
 
140
+ def named_captures
141
+ @names.zip(captures).to_h
142
+ end
143
+
139
144
  def [](x)
140
145
  idx = @offsets[x - 1] + x
141
146
  @match[idx]
@@ -56,7 +56,6 @@ module ActionDispatch
56
56
  end
57
57
 
58
58
  def simulator
59
- return if ast.nil?
60
59
  @simulator ||= begin
61
60
  gtg = GTG::Builder.new(ast).transition_table
62
61
  GTG::Simulator.new(gtg)
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "erb"
4
+ require "action_dispatch/http/request"
5
+ require "active_support/actionable_error"
6
+
7
+ module ActionDispatch
8
+ class ActionableExceptions # :nodoc:
9
+ cattr_accessor :endpoint, default: "/rails/actions"
10
+
11
+ def initialize(app)
12
+ @app = app
13
+ end
14
+
15
+ def call(env)
16
+ request = ActionDispatch::Request.new(env)
17
+ return @app.call(env) unless actionable_request?(request)
18
+
19
+ ActiveSupport::ActionableError.dispatch(request.params[:error].to_s.safe_constantize, request.params[:action])
20
+
21
+ redirect_to request.params[:location]
22
+ end
23
+
24
+ private
25
+ def actionable_request?(request)
26
+ request.show_exceptions? && request.post? && request.path == endpoint
27
+ end
28
+
29
+ def redirect_to(location)
30
+ body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(location)}\">redirected</a>.</body></html>"
31
+
32
+ [302, {
33
+ "Content-Type" => "text/html; charset=#{Response.default_charset}",
34
+ "Content-Length" => body.bytesize.to_s,
35
+ "Location" => location,
36
+ }, [body]]
37
+ end
38
+ end
39
+ end
@@ -338,7 +338,7 @@ module ActionDispatch
338
338
 
339
339
  def update_cookies_from_jar
340
340
  request_jar = @request.cookie_jar.instance_variable_get(:@cookies)
341
- set_cookies = request_jar.reject { |k, _| @delete_cookies.key?(k) }
341
+ set_cookies = request_jar.reject { |k, _| @delete_cookies.key?(k) || @set_cookies.key?(k) }
342
342
 
343
343
  @cookies.update set_cookies if set_cookies
344
344
  end
@@ -4,6 +4,8 @@ require "action_dispatch/http/request"
4
4
  require "action_dispatch/middleware/exception_wrapper"
5
5
  require "action_dispatch/routing/inspector"
6
6
 
7
+ require "active_support/actionable_error"
8
+
7
9
  require "action_view"
8
10
  require "action_view/base"
9
11
 
@@ -60,7 +62,11 @@ module ActionDispatch
60
62
  log_error(request, wrapper)
61
63
 
62
64
  if request.get_header("action_dispatch.show_detailed_exceptions")
63
- content_type = request.formats.first
65
+ begin
66
+ content_type = request.formats.first
67
+ rescue Mime::Type::InvalidMimeType
68
+ render_for_api_request(Mime[:text], wrapper)
69
+ end
64
70
 
65
71
  if api_request?(content_type)
66
72
  render_for_api_request(content_type, wrapper)
@@ -142,7 +148,7 @@ module ActionDispatch
142
148
  message = []
143
149
  message << " "
144
150
  message << "#{exception.class} (#{exception.message}):"
145
- message.concat(exception.annoted_source_code) if exception.respond_to?(:annoted_source_code)
151
+ message.concat(exception.annotated_source_code) if exception.respond_to?(:annotated_source_code)
146
152
  message << " "
147
153
  message.concat(trace)
148
154
 
@@ -52,5 +52,9 @@ module ActionDispatch
52
52
  super
53
53
  end
54
54
  end
55
+
56
+ def protect_against_forgery?
57
+ false
58
+ end
55
59
  end
56
60
  end
@@ -12,6 +12,7 @@ module ActionDispatch
12
12
  "ActionController::UnknownHttpMethod" => :method_not_allowed,
13
13
  "ActionController::NotImplemented" => :not_implemented,
14
14
  "ActionController::UnknownFormat" => :not_acceptable,
15
+ "Mime::Type::InvalidMimeType" => :not_acceptable,
15
16
  "ActionController::MissingExactTemplate" => :not_acceptable,
16
17
  "ActionController::InvalidAuthenticityToken" => :unprocessable_entity,
17
18
  "ActionController::InvalidCrossOriginRequest" => :unprocessable_entity,
@@ -21,8 +21,12 @@ module ActionDispatch
21
21
  def call(env)
22
22
  request = ActionDispatch::Request.new(env)
23
23
  status = request.path_info[1..-1].to_i
24
- content_type = request.formats.first
25
- body = { status: status, error: Rack::Utils::HTTP_STATUS_CODES.fetch(status, Rack::Utils::HTTP_STATUS_CODES[500]) }
24
+ begin
25
+ content_type = request.formats.first
26
+ rescue Mime::Type::InvalidMimeType
27
+ content_type = Mime[:text]
28
+ end
29
+ body = { status: status, error: Rack::Utils::HTTP_STATUS_CODES.fetch(status, Rack::Utils::HTTP_STATUS_CODES[500]) }
26
30
 
27
31
  render(status, content_type, body)
28
32
  end
@@ -34,7 +34,28 @@ module ActionDispatch
34
34
  end
35
35
 
36
36
  def build(app)
37
- klass.new(app, *args, &block)
37
+ InstrumentationProxy.new(klass.new(app, *args, &block), inspect)
38
+ end
39
+ end
40
+
41
+ # This class is used to instrument the execution of a single middleware.
42
+ # It proxies the `call` method transparently and instruments the method
43
+ # call.
44
+ class InstrumentationProxy
45
+ EVENT_NAME = "process_middleware.action_dispatch"
46
+
47
+ def initialize(middleware, class_name)
48
+ @middleware = middleware
49
+
50
+ @payload = {
51
+ middleware: class_name,
52
+ }
53
+ end
54
+
55
+ def call(env)
56
+ ActiveSupport::Notifications.instrument(EVENT_NAME, @payload) do
57
+ @middleware.call(env)
58
+ end
38
59
  end
39
60
  end
40
61
 
@@ -97,8 +118,8 @@ module ActionDispatch
97
118
  middlewares.push(build_middleware(klass, args, block))
98
119
  end
99
120
 
100
- def build(app = Proc.new)
101
- middlewares.freeze.reverse.inject(app) { |a, e| e.build(a) }
121
+ def build(app = nil, &block)
122
+ middlewares.freeze.reverse.inject(app || block) { |a, e| e.build(a) }
102
123
  end
103
124
 
104
125
  private
@@ -0,0 +1,13 @@
1
+ <% actions = ActiveSupport::ActionableError.actions(exception) %>
2
+
3
+ <% if actions.any? %>
4
+ <div class="actions">
5
+ <% actions.each do |action, _| %>
6
+ <%= button_to action, ActionDispatch::ActionableExceptions.endpoint, params: {
7
+ error: exception.class.name,
8
+ action: action,
9
+ location: request.path
10
+ } %>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
@@ -8,7 +8,11 @@
8
8
  </header>
9
9
 
10
10
  <div id="container">
11
- <h2><%= h @exception.message %></h2>
11
+ <h2>
12
+ <%= h @exception.message %>
13
+
14
+ <%= render "rescues/actions", exception: @exception, request: @request %>
15
+ </h2>
12
16
 
13
17
  <%= render "rescues/source", source_extracts: @source_extracts, show_source_idx: @show_source_idx, error_index: 0 %>
14
18
  <%= render "rescues/trace", traces: @traces, trace_to_show: @trace_to_show, error_index: 0 %>
@@ -13,6 +13,9 @@
13
13
  <% if defined?(ActiveStorage) && @exception.message.match?(%r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}) %>
14
14
  <br />To resolve this issue run: rails active_storage:install
15
15
  <% end %>
16
+ <% if defined?(ActionMailbox) && @exception.message.match?(%r{#{ActionMailbox::InboundEmail.table_name}}) %>
17
+ <br />To resolve this issue run: rails action_mailbox:install
18
+ <% end %>
16
19
  </h2>
17
20
 
18
21
  <%= render "rescues/source", source_extracts: @source_extracts, show_source_idx: @show_source_idx %>
@@ -6,6 +6,8 @@
6
6
  <%= @exception.message %>
7
7
  <% if defined?(ActiveStorage) && @exception.message.match?(%r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}) %>
8
8
  To resolve this issue run: rails active_storage:install
9
+ <% if defined?(ActionMailbox) && @exception.message.match?(%r{#{ActionMailbox::InboundEmail.table_name}}) %>
10
+ To resolve this issue run: rails action_mailbox:install
9
11
  <% end %>
10
12
 
11
13
  <%= render template: "rescues/_source" %>
@@ -117,6 +117,10 @@
117
117
  background-color: #FFCCCC;
118
118
  }
119
119
 
120
+ .button_to {
121
+ display: inline-block;
122
+ }
123
+
120
124
  .hidden {
121
125
  display: none;
122
126
  }
@@ -210,8 +210,8 @@ module ActionDispatch
210
210
  # === +assert_routing+
211
211
  #
212
212
  # def test_movie_route_properly_splits
213
- # opts = {controller: "plugin", action: "checkout", id: "2"}
214
- # assert_routing "plugin/checkout/2", opts
213
+ # opts = {controller: "plugin", action: "checkout", id: "2"}
214
+ # assert_routing "plugin/checkout/2", opts
215
215
  # end
216
216
  #
217
217
  # +assert_routing+ lets you test whether or not the route properly resolves into options.
@@ -219,8 +219,8 @@ module ActionDispatch
219
219
  # === +assert_recognizes+
220
220
  #
221
221
  # def test_route_has_options
222
- # opts = {controller: "plugin", action: "show", id: "12"}
223
- # assert_recognizes opts, "/plugins/show/12"
222
+ # opts = {controller: "plugin", action: "show", id: "12"}
223
+ # assert_recognizes opts, "/plugins/show/12"
224
224
  # end
225
225
  #
226
226
  # Note the subtle difference between the two: +assert_routing+ tests that
@@ -115,9 +115,9 @@ module ActionDispatch
115
115
  @defaults = defaults
116
116
  @set = set
117
117
 
118
- @to = to
119
- @default_controller = controller
120
- @default_action = default_action
118
+ @to = intern(to)
119
+ @default_controller = intern(controller)
120
+ @default_action = intern(default_action)
121
121
  @ast = ast
122
122
  @anchor = anchor
123
123
  @via = via
@@ -222,6 +222,10 @@ module ActionDispatch
222
222
  private :build_path
223
223
 
224
224
  private
225
+ def intern(object)
226
+ object.is_a?(String) ? -object : object
227
+ end
228
+
225
229
  def add_wildcard_options(options, formatted, path_ast)
226
230
  # Add a constraint for wildcard route to make it non-greedy and match the
227
231
  # optional format part of the route by default.
@@ -1141,6 +1145,10 @@ module ActionDispatch
1141
1145
  attr_reader :controller, :path, :param
1142
1146
 
1143
1147
  def initialize(entities, api_only, shallow, options = {})
1148
+ if options[:param].to_s.include?(":")
1149
+ raise ArgumentError, ":param option can't contain colons"
1150
+ end
1151
+
1144
1152
  @name = entities.to_s
1145
1153
  @path = (options[:path] || @name).to_s
1146
1154
  @controller = (options[:controller] || @name).to_s
@@ -1398,6 +1406,8 @@ module ActionDispatch
1398
1406
  # as a comment on a blog post like <tt>/posts/a-long-permalink/comments/1234</tt>
1399
1407
  # to be shortened to just <tt>/comments/1234</tt>.
1400
1408
  #
1409
+ # Set <tt>shallow: false</tt> on a child resource to ignore a parent's shallow parameter.
1410
+ #
1401
1411
  # [:shallow_path]
1402
1412
  # Prefixes nested shallow routes with the specified path.
1403
1413
  #
@@ -1440,6 +1450,9 @@ module ActionDispatch
1440
1450
  # Allows you to specify the default value for optional +format+
1441
1451
  # segment or disable it by supplying +false+.
1442
1452
  #
1453
+ # [:param]
1454
+ # Allows you to override the default param name of +:id+ in the URL.
1455
+ #
1443
1456
  # === Examples
1444
1457
  #
1445
1458
  # # routes call <tt>Admin::PostsController</tt>
@@ -1665,7 +1678,8 @@ module ActionDispatch
1665
1678
  return true
1666
1679
  end
1667
1680
 
1668
- if options.delete(:shallow)
1681
+ if options[:shallow]
1682
+ options.delete(:shallow)
1669
1683
  shallow do
1670
1684
  send(method, resources.pop, options, &block)
1671
1685
  end
@@ -317,23 +317,21 @@ module ActionDispatch
317
317
  #
318
318
  def define_url_helper(mod, route, name, opts, route_key, url_strategy)
319
319
  helper = UrlHelper.create(route, opts, route_key, url_strategy)
320
- mod.module_eval do
321
- define_method(name) do |*args|
322
- last = args.last
323
- options = \
324
- case last
325
- when Hash
326
- args.pop
327
- when ActionController::Parameters
328
- args.pop.to_h
329
- end
330
- helper.call self, args, options
331
- end
320
+ mod.define_method(name) do |*args|
321
+ last = args.last
322
+ options = \
323
+ case last
324
+ when Hash
325
+ args.pop
326
+ when ActionController::Parameters
327
+ args.pop.to_h
328
+ end
329
+ helper.call self, args, options
332
330
  end
333
331
  end
334
332
  end
335
333
 
336
- # strategy for building urls to send to the client
334
+ # strategy for building URLs to send to the client
337
335
  PATH = ->(options) { ActionDispatch::Http::URL.path_for(options) }
338
336
  UNKNOWN = ->(options) { ActionDispatch::Http::URL.url_for(options) }
339
337
 
@@ -593,14 +591,14 @@ module ActionDispatch
593
591
  if route.segment_keys.include?(:controller)
594
592
  ActiveSupport::Deprecation.warn(<<-MSG.squish)
595
593
  Using a dynamic :controller segment in a route is deprecated and
596
- will be removed in Rails 6.0.
594
+ will be removed in Rails 6.1.
597
595
  MSG
598
596
  end
599
597
 
600
598
  if route.segment_keys.include?(:action)
601
599
  ActiveSupport::Deprecation.warn(<<-MSG.squish)
602
600
  Using a dynamic :action segment in a route is deprecated and
603
- will be removed in Rails 6.0.
601
+ will be removed in Rails 6.1.
604
602
  MSG
605
603
  end
606
604
 
@@ -39,7 +39,8 @@ module ActionDispatch
39
39
 
40
40
  private
41
41
  def image_name
42
- failed? ? "failures_#{method_name}" : method_name
42
+ name = method_name[0...225]
43
+ failed? ? "failures_#{name}" : name
43
44
  end
44
45
 
45
46
  def image_path
@@ -16,12 +16,14 @@ module ActionDispatch
16
16
  super
17
17
  end
18
18
 
19
+ def before_teardown
20
+ take_failed_screenshot
21
+ ensure
22
+ super
23
+ end
24
+
19
25
  def after_teardown
20
- begin
21
- take_failed_screenshot
22
- ensure
23
- Capybara.reset_sessions!
24
- end
26
+ Capybara.reset_sessions!
25
27
  ensure
26
28
  super
27
29
  end
@@ -38,8 +38,8 @@ module ActionDispatch
38
38
  end
39
39
 
40
40
  def self.parser(content_type)
41
- mime = Mime::Type.lookup(content_type)
42
- encoder(mime ? mime.ref : nil).response_parser
41
+ type = Mime::Type.lookup(content_type).ref if content_type
42
+ encoder(type).response_parser
43
43
  end
44
44
 
45
45
  def self.encoder(name)
@@ -10,7 +10,7 @@ module ActionPack
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "beta3"
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta3
4
+ version: 6.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0.beta3
19
+ version: 6.0.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.0.beta3
26
+ version: 6.0.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.0.beta3
95
+ version: 6.0.0.rc1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 6.0.0.beta3
102
+ version: 6.0.0.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 6.0.0.beta3
109
+ version: 6.0.0.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 6.0.0.beta3
116
+ version: 6.0.0.rc1
117
117
  description: Web apps on Rails. Simple, battle-tested conventions for building and
118
118
  testing MVC web applications. Works with any Rack-compatible server.
119
119
  email: david@loudthinking.com
@@ -220,6 +220,7 @@ files:
220
220
  - lib/action_dispatch/journey/visualizer/fsm.css
221
221
  - lib/action_dispatch/journey/visualizer/fsm.js
222
222
  - lib/action_dispatch/journey/visualizer/index.html.erb
223
+ - lib/action_dispatch/middleware/actionable_exceptions.rb
223
224
  - lib/action_dispatch/middleware/callbacks.rb
224
225
  - lib/action_dispatch/middleware/cookies.rb
225
226
  - lib/action_dispatch/middleware/debug_exceptions.rb
@@ -241,6 +242,8 @@ files:
241
242
  - lib/action_dispatch/middleware/ssl.rb
242
243
  - lib/action_dispatch/middleware/stack.rb
243
244
  - lib/action_dispatch/middleware/static.rb
245
+ - lib/action_dispatch/middleware/templates/rescues/_actions.html.erb
246
+ - lib/action_dispatch/middleware/templates/rescues/_actions.text.erb
244
247
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
245
248
  - lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb
246
249
  - lib/action_dispatch/middleware/templates/rescues/_source.html.erb
@@ -297,12 +300,12 @@ files:
297
300
  - lib/action_pack.rb
298
301
  - lib/action_pack/gem_version.rb
299
302
  - lib/action_pack/version.rb
300
- homepage: http://rubyonrails.org
303
+ homepage: https://rubyonrails.org
301
304
  licenses:
302
305
  - MIT
303
306
  metadata:
304
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta3/actionpack
305
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta3/actionpack/CHANGELOG.md
307
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.0.rc1/actionpack
308
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.0.rc1/actionpack/CHANGELOG.md
306
309
  post_install_message:
307
310
  rdoc_options: []
308
311
  require_paths: