回形针上传的文件被删除了?

Paperclip uploaded files deleted?

我使用回形针 gem 上传了几个文件,现在它们都不见了。我想知道是什么导致删除上传的文件。根据回形针文档。

The files that are assigned as attachments are, by default, placed in the directory specified by the :path option to has_attached_file. By default, this location is :rails_root/public/system/:class/:attachment/:id_partition/:style/:filename. This location was chosen because, on standard Capistrano deployments, the public/system directory can be symlinked to the app's shared directory, meaning it survives between deployments. For example, using that :path, you may have a file at

/data/myapp/releases/20081229172410/public/system/users/avatar/000/000/013/small/my_pic.png

上传文件后我做了很少的 capistrano 部署,但上传的文件应该会保留下来。我想知道是什么导致文件删除。感谢您的帮助!

确保您在不同版本之间共享 public/system 目录。否则每个版本都将以空白开始。

# deploy.rb
append :linked_dirs, "public/system"