Forum: Ruby on Rails column link to file, to do an file open or save as

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.
C43ccfa65613c5bdfe3434dbe3b29fe1?d=identicon&s=25 idmkid (Guest)
on 2007-04-20 23:57
(Received via mailing list)
Is there an easy way to have a column in MySQL link to a file within
Ruby on Rails so that when the user is looking at the website, they
can click on the data in the column and have it link to a file and
choose to download or open the file?

I am currently using active_scaffold.
I am a newbie to Ruby on Rails.

7b74ccf93dde7dd2ac5d2980d14fdc7b?d=identicon&s=25 Paul Lynch (plynchnlm)
on 2007-04-21 00:42
(Received via mailing list)
If I understand you correctly, you have some files associated with the
records in a table, and when the user is viewing the data for a
record, you want to give them a link so that that they can download
the file.  Is that right?

If so, I suppose you could store the file name in the table, make the
file name available to your .rhtml file for the page showing the
record, and then include some ERB code like:
           <a href="http://server:3000/path/to/data/dir/<%=
@data_file_name %>">Download</a>
That would bring it up in their web-browser, but they could right-
click and choose "save link as...".
This topic is locked and can not be replied to.