# Rendering any file type from an action

**URL:** <https://www.ruby-forum.com/t/rendering-any-file-type-from-an-action/110522>\
**Category:** Rails\
**Created:** [July 27, 2007, 4:51am UTC](https://www.ruby-forum.com/t/rendering-any-file-type-from-an-action/110522 "2007-07-27T04:51:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tusharr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tusharr](https://www.ruby-forum.com/u/tusharr)\
**Post date:** [July 27, 2007, 4:51am UTC](https://www.ruby-forum.com/t/rendering-any-file-type-from-an-action/110522/1 "2007-07-27T04:51:04Z")

</div>

I have an app that uses attachment\_fu plugin with database at the  
backend for attachments. I have no restriction on Mime types that can  
be stored. The problem I’m having is related to rendering the files  
(allowing users to download the file.

def show  
@stored\_file = StoredFile.find(params[:id])

##### How do I render the file to the user:

@stored\_file.db\_file.data  
end

I tried respond\_to, but that doesn’t work for un-registered Mime  
Types.

Any help is greatly appreciated

---

<div class="post-metadata">

**Author:** ![tusharr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tusharr](https://www.ruby-forum.com/u/tusharr)\
**Post date:** [July 27, 2007, 10:39am UTC](https://www.ruby-forum.com/t/rendering-any-file-type-from-an-action/110522/2 "2007-07-27T10:39:29Z")

</div>

You could put a link to the public\_filename instead of a show method -  
then  
rendering download will be a function of the user’s browser settings -  
in my  
case images will show in firefox, pdf’s will download etc…

I could be completely wrong about this though 🙂
