Forum: Ruby on Rails How to find the base URI address of a Rails site?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Phlip (Guest)
on 2007-03-29 00:08
(Received via mailing list)
Railsters:

Suppose I have a site hosted by a real web server, such as Apache, and
it doesn't put the site on http://server/. Suppose it puts the site
down in http://server/path/path/path/.

If I call url_for('/') it just passes that thru. (Parenthetically:
Why? What's the point?)

I need to get the complete path that the server uses to dispatch to
the base of the Rails site. Where is this crumb of data?

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
Russell N. (Guest)
on 2007-03-29 21:38
(Received via mailing list)
request.host ? I think that'd work if I understand your question
correctly.

RSL
Russell N. (Guest)
on 2007-03-29 21:41
(Received via mailing list)
Okay. Disregard my last post. I was rereading this and realized I posted
the
exact _wrong_ answer. Sorry.

RSL
Phlip (Guest)
on 2007-03-30 06:11
(Received via mailing list)
Russell N. wrote:

> Okay. Disregard my last post.

Yeah! You could'a found it in one Google hit:

http://www.google.com/codesearch?q=lang%3Aruby+image_path

The first citation yields

def image_path(source)
  compute_public_path(source, 'images', 'png')

And compute_public_path is wisely private, so I can't abuse it. Yet it
contains this:

   @request.relative_url_root

And now the answer is documented. (-;

--
  Phlip
Russell N. (Guest)
on 2007-03-30 16:24
(Received via mailing list)
Heh. I love your attitude. Make fun of me for not Googling when you
didn't
Google yourself. Sorry I tried to help.

RSL
This topic is locked and can not be replied to.