# Column link to file, to do an file open or save as

**URL:** <https://www.ruby-forum.com/t/column-link-to-file-to-do-an-file-open-or-save-as/92578>\
**Category:** Rails\
**Created:** [April 20, 2007, 11:57pm UTC](https://www.ruby-forum.com/t/column-link-to-file-to-do-an-file-open-or-save-as/92578 "2007-04-20T23:57:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![idmkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/71e660/32.png) [@idmkid](https://www.ruby-forum.com/u/idmkid)\
**Post date:** [April 20, 2007, 11:57pm UTC](https://www.ruby-forum.com/t/column-link-to-file-to-do-an-file-open-or-save-as/92578/1 "2007-04-20T23:57:12Z")

</div>

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.

Thanks,  
Fred

---

<div class="post-metadata">

**Author:** ![idmkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/71e660/32.png) [@idmkid](https://www.ruby-forum.com/u/idmkid)\
**Post date:** [April 21, 2007, 12:42am UTC](https://www.ruby-forum.com/t/column-link-to-file-to-do-an-file-open-or-save-as/92578/2 "2007-04-21T00:42:15Z")

</div>

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:  
[Download](http://server:3000/path/to/data/dir/<%=%0A@data_file_name%20%>)  
That would bring it up in their web-browser, but they could right-  
click and choose “save link as…”.
