rails route current path code example
Example 1: rails get current path
request.url
# => "http://localhost:3000/lists/7/items"
request.path
# => "/lists/7/items"
Example 2: check current route rails
current_uri = request.env['PATH_INFO']
request.url
# => "http://localhost:3000/lists/7/items"
request.path
# => "/lists/7/items"
current_uri = request.env['PATH_INFO']