instance method
route_uri_pattern
Ruby on Rails 8.1.2
Since v7.1.6Signature
route_uri_pattern()
Returns the URI pattern of the matched route for the request, using the same format as bin/rails routes:
request.route_uri_pattern # => "/:controller(/:action(/:id))(.:format)"
Source
# File actionpack/lib/action_dispatch/http/request.rb, line 159
def route_uri_pattern
unless pattern = get_header("action_dispatch.route_uri_pattern")
route = get_header("action_dispatch.route")
return if route.nil?
pattern = route.path.spec.to_s
set_header("action_dispatch.route_uri_pattern", pattern)
end
pattern
end
Defined in actionpack/lib/action_dispatch/http/request.rb line 159
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Request