lib/carrierwave/storage/file.rb in jnicklas-carrierwave-0.1 vs lib/carrierwave/storage/file.rb in jnicklas-carrierwave-0.1.1
- old
+ new
@@ -1,7 +1,13 @@
module CarrierWave
module Storage
+
+ ##
+ # File storage stores file to the Filesystem (surprising, no?). There's really not much
+ # to it, it uses the store_dir defined on the uploader as the storage location. That's
+ # pretty much it.
+ #
class File < Abstract
def initialize(uploader)
@uploader = uploader
end
@@ -14,11 +20,11 @@
#
# @return [CarrierWave::SanitizedFile] a sanitized file
#
def self.store!(uploader, file)
path = ::File.join(uploader.store_dir, uploader.filename)
- path = ::File.expand_path(path, uploader.root)
+ path = ::File.expand_path(path, uploader.public)
file.move_to(path)
file
end
##
@@ -29,10 +35,10 @@
#
# @return [CarrierWave::SanitizedFile] a sanitized file
#
def self.retrieve!(uploader, identifier)
path = ::File.join(uploader.store_dir, identifier)
- path = ::File.expand_path(path, uploader.root)
+ path = ::File.expand_path(path, uploader.public)
CarrierWave::SanitizedFile.new(path)
end
end # File
end # Storage
\ No newline at end of file