lib/carrierwave/storage/file.rb in carrierwave-0.2.1 vs lib/carrierwave/storage/file.rb in carrierwave-0.2.3

- old
+ new

@@ -11,10 +11,29 @@ def initialize(uploader) @uploader = uploader end ## + # Delete the file to the uploader's store path. + # + # === Parameters + # + # [uploader (CarrierWave::Uploader)] an uploader object + # [file (CarrierWave::SanitizedFile)] the file to store + # + # === Returns + # + # [bool] True if file was removed or false + # + def self.destroy!(uploader, file) + unless file.blank? + CarrierWave.logger.info "CarrierWave::Storage::File: removing file #{file.path}" + file.delete + end + end + + ## # Move the file to the uploader's store path. # # === Parameters # # [uploader (CarrierWave::Uploader)] an uploader object @@ -49,6 +68,6 @@ CarrierWave::SanitizedFile.new(path) end end # File end # Storage -end # CarrierWave \ No newline at end of file +end # CarrierWave