There are a number of reasons you might want to get the current path. For example, you might chose to create a menu system that compares the current path against a list of paths that are available and use that to add the “current” class so you could indicate which page you were currently on.
This current path is located inside the request.env['REQUEST_PATH'] property. A shortcut to this property is request.path.
{ 0 comments… add one now }