diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index 992c1a9efedf01110a7e6fe5ef5c09d5776aa640..62bd4a33f24016061cadac15361a61ae50ac83ed 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -1,4 +1,5 @@ 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) }