Accessing file in public directory


#1

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:
Learn
more

It doesn’t work. Any idea why?

Thanks,

Lantis.


#2

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:
Learn
more

It doesn’t work. Any idea why?
It should do. Does a non-javascript link
work?


#3

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:
Learn
more

It doesn’t work. Any idea why?
It should do. Does a non-javascript link
work?

It does work in my local machine. It doesn’t work though when i put it
on a web server. A normal link doesnt work
either when i put it on the web server.


#4

Lantis S. wrote:

It should do. Does a non-javascript link
work?

It does work in my local machine. It doesn’t work though when i put it
on a web server. A normal link 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?


#5

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:


#6

In that case, it looks like you’ll need to use:

link

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.


#7

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:

In that case, it looks like you’ll need to use:

link

Can’t think off the top of my head why you might need the extra routing
information, though.