Q:

Rails, Download from BLOB database

i have one problem
I save my upload data in the blob file type in the database..
now i want to download it..
how to manage that
i have try this way (document_file is a field with blob data)
send_file @attachment.document_file, :disposition => 'attachment'
but comes error...
anyone can help?
Thanks  :)

A:

Maybe you should use send_data for a blob data instead of send_file:
send_data @attachment.document_file, :disposition => 'attachment'

Consider that 'attachment' is the default value, so you can omit it. You should get this error because send_file needs a file path as argument, not a blob.
You can also take a look at: http://api.rubyonrails.org/classes/ActionController/Streaming.html#method-i-send_data

