Forum: Ruby on Rails Using base HTML tag

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.
B195d36cbb47ff2b67a80e3b8c43e727?d=identicon&s=25 John Smith (ohnnyj)
on 2005-12-30 00:04
Hello all:

I have been using PHP for quite a bit and am beginning to learn more
about RoR.  One thing I used to to in PHP scripts (views in particular)
was to have a tag such as:

<base href="http://<?php echo $_SERVER['HTTP_HOST'] .
$_SERVER['SCRIPT_NAME']; ?>" />

so that URL rewriting would not throw off the paths to images, css, etc.

Is there an equivalent way to do this in RoR?

Thanks,

John
7a28bf7b0932a9486c21f1a33eb431ba?d=identicon&s=25 Tom Lieber (Guest)
on 2005-12-31 20:29
(Received via mailing list)
On 12/29/05, John Smith <john.smith@sherwoodmechanical.com> wrote:
> I have been using PHP for quite a bit and am beginning to learn more
> about RoR.  One thing I used to to in PHP scripts (views in particular)
> was to have a tag such as:
>
> <base href="http://<?php echo $_SERVER['HTTP_HOST'] .
> $_SERVER['SCRIPT_NAME']; ?>" />
>
> so that URL rewriting would not throw off the paths to images, css, etc.
>
> Is there an equivalent way to do this in RoR?

Lucky for you, as long as you use the HTML helpers (image_tag,
stylesheet_link_tag, etc.) the URLs are created automatically such
that setting the <base> for your pages is unnecessary.

> Thanks,
>
> John

Sincerely,

Tom Lieber
tom@alltom.com
http://AllTom.com/
This topic is locked and can not be replied to.