lib/carrierwave/uploader/proxy.rb in carrierwave-3.0.0.beta vs lib/carrierwave/uploader/proxy.rb in carrierwave-3.0.0.rc
- old
+ new
@@ -28,21 +28,34 @@
# === Returns
#
# [String] uniquely identifies a file
#
def identifier
- @identifier || storage.try(:identifier)
+ @identifier || (file && storage.try(:identifier))
end
##
+ # Returns a String which is to be used as a temporary value which gets assigned to the column.
+ # The purpose is to mark the column that it will be updated. Finally before the save it will be
+ # overwritten by the #identifier value, which is usually #filename.
+ #
+ # === Returns
+ #
+ # [String] a temporary_identifier, by default @original_filename is used
+ #
+ def temporary_identifier
+ @original_filename || @identifier
+ end
+
+ ##
# Read the contents of the file
#
# === Returns
#
# [String] contents of the file
#
- def read
- file.try(:read)
+ def read(*args)
+ file.try(:read, *args)
end
##
# Fetches the size of the currently stored/cached file
#