You can set headers for the response, for example:
def download
@file = Attachment.find params[:id]
response.headers['Content-Length'] = @file.size.to_s
send_file @file.path, :x_sendfile => true
end
You can find more about the response object in official documents .
PS: The title should be a string to work correctly with some web servers.
source
share