Last active
August 29, 2015 14:05
-
-
Save peterkeen/54196b60a3d885d36ff2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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