Send large file with rails


I am having problem with sending file to browser with rails, to let the
user download them.

Here is my situation:

I have built a little webmail client, and I need to make attachments
downloadable to the users. I have the base64 ecoded rappresentation of
the file, and I don't know how to generate and send the file.

I have tried send_data, with disposition :attachment, but the request
take a lot of time and it doesn't even prompt the download dialog. I am
surely missing the whole point here, and I need some clarity.


You really want to be using send_file rather than send_data, because send_data ties up your rails process sending the data whereas send_file will offload to apache/nginx if properly setup (on apache this requires the X-Sendfile module, I forget what the nginx equivalent is)