Rerquest.whole_url? :: does this exist already somewhere?

Hi all

I need to determine the whole URL that a user visits. So I created the
following method:

class ActionController::AbstractRequest
def whole_url
protocol + host_with_port + request_uri

However, I can’t imagine that there’s not already a method like this
somewhere implemented? Or isn’t there?

Thanks for info

request.env[‘REQUEST_URI’] should do it. It won’t include the query
string in the path (those are in params) or any anchor fragment.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs