class FileUploader < CarrierWave::Uploader::Base storage :file before :store, :remember_cache_id after :store, :delete_tmp_dir # store! nil's the cache_id after it finishes so we need to remember it for deletion def remember_cache_id(new_file) @cache_id_was = cache_id end def delete_tmp_dir(new_file) # make sure we don't delete other things accidentally by checking the name pattern if @cache_id_wa