In Rails (version 3), request.url can show
http://www.foo.com/products/123
but what about just to get
http://www.foo.com
or
http://www.foo.com/
? There are 2 apparent ways, one is using regular expression, which is not very clean, and the other is
"#{request.scheme}://#{request.host}"
and it is kind of ugly either. Is there a cleaner to do it?
This will get you what
request.urlgets you, but without the path: