Forum: Ruby on Rails Which request-method returns the whole REQUEST_URI?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Joshua M. (Guest)
on 2007-04-03 20:01
Hi all

I need to display the whole address that's in the address bar of the
browser in a view.


I tried with request.request_uri, but sadly this only gives me the path
after the domain and port:


I saw that request.env_table['REQUEST_URI'] gives me the wanted result,
but it seems that this is not available in testing environment.

So i hacked this dirty little helper:

  def whole_url
    protocol + host_with_port + request_uri

But I guess it's not very error proven, because what happens when the
default port is used and I only need

but whole_url gives me

? So I guess there's for sure a better way to solve my problem... Any
hints? Thanks. :-)

This topic is locked and can not be replied to.