提交 c23bb156 编写于 作者: G Godfrey Chan

Deprecate passing an invalid name to `Formatter#generate`

The internal tests that (incorrectly) relied on this were already fixed in
938d130c. However, we cannot simply fix this bug because the guides prior to
b7b9e920 recommended a workaround that relies on this buggy behavior.

Reference #17453
上级 938d130c
require 'action_controller/metal/exceptions'
require 'active_support/deprecation'
module ActionDispatch
module Journey
......@@ -80,6 +81,15 @@ def match_route(name, options)
if named_routes.key?(name)
yield named_routes[name]
else
if name
ActiveSupport::Deprecation.warn <<-MSG.squish
You are trying to generate the URL for a named route called
#{name.inspect} but no such route was found. In the future,
this will result in an `ActionController::UrlGenerationError`
exception.
MSG
end
routes = non_recursive(cache, options)
hash = routes.group_by { |_, r| r.score(options) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册