Forum: Ruby on Rails Link to public folder for attachments.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
eyal (Guest)
on 2009-02-28 21:06
(Received via mailing list)

In the directory that holds my site, I have a symlink from to the public folder in my rails application.
That public folder holds a folder called uploads which contains
attachments that are sent there by the attachment_fu plugin.

However, when I link to one of these files:

<%= link_to "my_file_name", "/uploads/0000/0009/my_file.pdf" %>

My browser sends me to,
instead of

That said, my javascript_include_tag and my stylesheet_link_tag work
correctly and send me to the right subdirectories of my public folder: and

So how do these tag_helpers know where my javascript and stylesheet
files are, and why doesn't rails know that my public folder is at ?

Any help would be very appreciated.

Julian L. (Guest)
on 2009-02-28 21:13
(Received via mailing list)
eyal (Guest)
on 2009-02-28 21:53
(Received via mailing list)
You mean:

 <%= link_to my_filename, url_for("uploads/0000/0009/my_file.pdf") %>

But this doesn't change anything. How else could I use url_for to
access an object in the public directory?

This topic is locked and can not be replied to.