instance method
interpolate_path
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
interpolate_path(template, params)
A decoded param must not give the target a scheme or host that the template lacks, or the redirect would leave the request’s host.
Parameters
-
templatereq -
paramsreq
Source
# File actionpack/lib/action_dispatch/routing/redirection.rb, line 119
def interpolate_path(template, params)
path = template % escape_path(params)
return path if template.match?(SCHEME_OR_AUTHORITY)
if path.start_with?("//")
path.sub("//", "/%2F")
elsif path.match?(SCHEME_OR_AUTHORITY)
"/#{path.sub(":", "%3A")}"
else
path
end
end
Defined in actionpack/lib/action_dispatch/routing/redirection.rb line 119
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::PathRedirect