rails "public/system/" 中的 "system" 文件夹有何用途?

What is the purpose of the "system" folder in rails "public/system/"?

在 rails 应用程序中存储非预编译 public 资产的标准位置是 "public/system." 这有什么原因吗?我想保持简单,为什么我不应该将资产放在 "public" 文件夹中?

public/system 文件夹本身不是 Rails 标准,甚至不是记录在案的建议。像 Capistrano 这样的部署工具采用了该约定作为建议,以建议您组织在部署之间共享且不应在您的存储库中的用户资产。这个想法是符号链接 public/system 到 capistrano 的 shared/system,它在发布文件夹之外。

如果您查看 paperclip's(这是一个广泛使用的上传库)文档,您会发现:

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.

在您的开发环境中,如果您愿意采用该约定,则应该忽略 .gitignore 中的该文件夹。