You can also do the following:
after_destroy :remove_file_directory def remove_file_directory path = File.expand_path(mount.store_path, mount.root) FileUtils.remove_dir(path, force: false) end
Where mount is what you installed_s For example: if you have mount_uploader :avatar, AvatarUploader , then
def remove_file_directory path = File.expand_path(avatar.store_path, avatar.root) FileUtils.remove_dir(path, force: false) end
source share