You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
skyeagle edited this page Jul 27, 2011
·
2 revisions
In case, when your file was uploaded for example through nginx upload module, it won't be removed like it would be as Tempfile(Rails, Rack uploaders create this instance for uploaded files). For this situation you could add a callback to the your uploader class:
after :cache, :unlink_original
def unlink_original(file)
return unless delete_original_file
file.delete if version_name.blank?
end
config/initializers/carrierwave.rb:
class CarrierWave::Uploader::Base
add_config :delete_original_file
end
CarrierWave.configure do |config|
config.delete_original_file = true
end