DEV Community

mpuchyr
mpuchyr

Posted on

Rails - Getting the Current URI

As I was attempting to figure out a way to conditionally render a page that required information from the uri, one idea that I had required a way to retrieve the entire url.

After doing some searching, I found the following:

current_uri = request.env['PATH_INFO']
Enter fullscreen mode Exit fullscreen mode

This acquires the entire current path in the address bar.

While I did not end up using the solution using the path and instead used params, I felt that this might be good information to have should I ever require the full path.

Top comments (0)