Created
October 1, 2011 23:31
-
-
Save sporkd/1256806 to your computer and use it in GitHub Desktop.
Save carrierwave attachment to tempfile
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
Tempfile.open("attachment", "#{Rails.root}/tmp") do |f| | |
f.binmode # my attachment is binary | |
f.write(model.attachment.file.read) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dont you need to unlink the file?