Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Last active Aug 29, 2015
Embed
What would you like to do?
if Rails.env.production?
resp = HTTParty.get(@sale.product.file.url)
filename = @sale.product.file.url
send_data resp.body,
:filename => File.basename(filename),
:content_type => resp.headers['Content-Type']
else
filename = File.expand_path(Sale.last.product.file_file_name, Rails.root)
send_data File.open(@sale.product.file_file_name),
:filename => File.basename(filename),
:content_type => @sale.product.file_content_type
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment