How to get the urls to public folder

Hi all,

I’m building an app where I keep a large number of files on the
harddisk such as RAILS_ROOT/public/data/foo.bin etc…

Within my database I have a field that gives me foo.bin.

In a view how do I get a fully qualified url such as
http://localhost:3000/data/foo.bin?
I tried using link_to but that gives a relative path.

c:> rails --version
Rails 2.1.1

Thanks in advance,
Theo

Theo,

On Thu, Oct 9, 2008 at 11:30 AM, Theo R. [email protected]
wrote:

I’m building an app where I keep a large number of files on the
harddisk such as RAILS_ROOT/public/data/foo.bin etc…

Within my database I have a field that gives me foo.bin.

In a view how do I get a fully qualified url such as http://localhost:3000/data/foo.bin?
I tried using link_to but that gives a relative path.

You can use the URL “/data/foo.bin”. Rails serves files from the
public directory by default. (For example, try creating data/foo.html
and going to http://localhost:3000/data/foo.html

c:> rails --version
Rails 2.1.1

Thanks in advance,
Theo


Jim M., [email protected], [email protected]
http://www.io.com/~jimm/