Forum: Ruby on Rails Accessing file in public directory

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.
15977b0a3b7e270bf3d1baaadfb79a59?d=identicon&s=25 Lantis Sephiro (lantis)
on 2006-05-23 05:59
How do i access a file in the public directory of rails application? I
have several html files in there and i want to link them from the rhtml
file. Basically  to display a popup. Here is the code in foo.rhtml:
<a href="javascript:popUp('/summary.html')" class="normal">Learn
more</a>
It doesn't work. Any idea why?

Thanks,

Lantis.
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-23 11:11
(Received via mailing list)
Lantis Sephiro wrote:
> How do i access a file in the public directory of rails application? I
> have several html files in there and i want to link them from the rhtml
> file. Basically  to display a popup. Here is the code in foo.rhtml:
> <a href="javascript:popUp('/summary.html')" class="normal">Learn
> more</a>
> It doesn't work. Any idea why?
It should do.  Does a non-javascript <a href='/summary.html'>link</a>
work?
15977b0a3b7e270bf3d1baaadfb79a59?d=identicon&s=25 Lantis Sephiro (lantis)
on 2006-05-23 14:07
Alex Young wrote:
> Lantis Sephiro wrote:
>> How do i access a file in the public directory of rails application? I
>> have several html files in there and i want to link them from the rhtml
>> file. Basically  to display a popup. Here is the code in foo.rhtml:
>> <a href="javascript:popUp('/summary.html')" class="normal">Learn
>> more</a>
>> It doesn't work. Any idea why?
> It should do.  Does a non-javascript <a href='/summary.html'>link</a>
> work?

It does work in my local machine. It doesn't work though when i put it
on a web server. A normal link <a href='/summary.html'> doesnt work
either when i put it on the web server.
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-23 14:36
(Received via mailing list)
Lantis Sephiro wrote:
>>
>>It should do.  Does a non-javascript <a href='/summary.html'>link</a>
>>work?
>
>
> It does work in my local machine. It doesn't work though when i put it
> on a web server. A normal link <a href='/summary.html'> doesnt work
> either when i put it on the web server.

Do the stylesheets work from the dynamic pages?  If so, what do the
stylesheet tags in the generated source look like?
15977b0a3b7e270bf3d1baaadfb79a59?d=identicon&s=25 Lantis Sephiro (lantis)
on 2006-05-23 14:49
> Do the stylesheets work from the dynamic pages?  If so, what do the
> stylesheet tags in the generated source look like?

The stylesheets work. This is the generated tag:
<link href="/project/demo/myapp/stylesheets/style.css" media="all"
rel="Stylesheet" type="text/css" />
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-23 14:59
(Received via mailing list)
Lantis Sephiro wrote:
>>Do the stylesheets work from the dynamic pages?  If so, what do the
>>stylesheet tags in the generated source look like?
>
>
> The stylesheets work. This is the generated tag:
> <link href="/project/demo/myapp/stylesheets/style.css" media="all"
> rel="Stylesheet" type="text/css" />
>
In that case, it looks like you'll need to use:

   <a href='/project/demo/myapp/summary.html'>link</a>

Can't think off the top of my head why you might need the extra routing
information, though.
15977b0a3b7e270bf3d1baaadfb79a59?d=identicon&s=25 Lantis Sephiro (lantis)
on 2006-05-23 15:30
> In that case, it looks like you'll need to use:
>
>    <a href='/project/demo/myapp/summary.html'>link</a>
>
> Can't think off the top of my head why you might need the extra routing
> information, though.

Prefixing '/project/demo/myapp/' for each link does the trick. Like you,
i still dont get why the extra routing is necessary. Is it because a
symbolic link to hook up the application?

THanks,

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