Created
December 19, 2013 06:28
-
-
Save kitallis/8035192 to your computer and use it in GitHub Desktop.
create a temporary path for a file in carrierwave, location agnostic - s3/local, so it'll work with tests
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
def temporary_path | |
file = Tempfile.new(['temp-creative-image-', ['.', self.image.file.extension].join], :encoding => 'ascii-8bit') | |
file.write(image.read) if image.file.exists? | |
file.path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment