lib/paperclip/iostream.rb in tristandunn-paperclip-2.3.1 vs lib/paperclip/iostream.rb in tristandunn-paperclip-2.3.1.1
- old
+ new
@@ -2,10 +2,11 @@
# and Tempfile conversion.
module IOStream
# Returns a Tempfile containing the contents of the readable object.
def to_tempfile
- tempfile = Tempfile.new("stream")
+ name = respond_to?(:original_filename) ? original_filename : (respond_to?(:path) ? path : "stream")
+ tempfile = Paperclip::Tempfile.new(File.basename(name))
tempfile.binmode
self.stream_to(tempfile)
end
# Copies one read-able object from one place to another in blocks, obviating the need to load