Displaying 1 result from an estimated 1 matches for "document_content_type".
2014 Mar 26
0
Heroku | Rails 4 | Ruby 2.0 - send_file not presenting file for download in the browser
...tion :set_blog_attachment, only: [:download]
def download
download_file(@blog_attachment)
send_file("#{Rails.root}/public/blog_attachments/#{@blog_attachment.document_file_name}",
filename: @blog_attachment.document_file_name,
type: @blog_attachment.document_content_type,
stream: true,
disposition: 'inline')
respond_to do |format|
format.js {}
end
end
private
def download_file(file)
File.open("#{Rails.root}/public/blog_attachments/#{file.document_file_name}",'wb') do |f|
f.writ...