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.
Lantis S. (Guest)
on 2006-05-23 07: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.
Alex Y. (Guest)
on 2006-05-23 13:11
(Received via mailing list)
Lantis S. 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?
Lantis S. (Guest)
on 2006-05-23 16:07
Alex Y. wrote:
> Lantis S. 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.
Alex Y. (Guest)
on 2006-05-23 16:36
(Received via mailing list)
Lantis S. 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?
Lantis S. (Guest)
on 2006-05-23 16: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" />
Alex Y. (Guest)
on 2006-05-23 16:59
(Received via mailing list)
Lantis S. 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.
Lantis S. (Guest)
on 2006-05-23 17: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.