926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
|
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 926
def recognize_path_with_request(req, path, , raise_on_missing: true)
@router.recognize(req) do |route, params|
params.merge!()
params.each do |key, value|
if value.is_a?(String)
value = value.dup.force_encoding(Encoding::BINARY)
params[key] = URI::RFC2396_PARSER.unescape(value)
end
end
req.path_parameters = params
app = route.app
if app.matches?(req) && app.dispatcher?
begin
req.controller_class
rescue NameError
raise ActionController::RoutingError, "A route matches #{path.inspect}, but references missing controller: #{params[:controller].camelize}Controller"
end
return req.path_parameters
elsif app.matches?(req) && app.engine?
path_parameters = app.rack_app.routes.recognize_path_with_request(req, path, , raise_on_missing: false)
return path_parameters if path_parameters
end
end
if raise_on_missing
raise ActionController::RoutingError, "No route matches #{path.inspect}"
end
end
|