Skip to content

Instantly share code, notes, and snippets.

@kitallis
Created December 19, 2013 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitallis/8035192 to your computer and use it in GitHub Desktop.
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
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