Forum: Ruby on Rails Rendering any file type from an action

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.
Tushar R. (Guest)
on 2007-07-27 06:51
(Received via mailing list)
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:

I tried respond_to, but that doesn't work for un-registered Mime

Any help is greatly appreciated
Ivor P. (Guest)
on 2007-07-27 12:39
(Received via mailing list)
You could put a link to the public_filename instead of a show method -
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 :)
This topic is locked and can not be replied to.