Rendering any file type from an action

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

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 :slight_smile: