如何在 Amazon S3 中自定义 Rails 5.2 ActiveStorage 附件的路径?

How can I customize the path of a Rails 5.2 ActiveStorage attachment in Amazon S3?

添加附件时如

has_one_attached :resume_attachment

保存的文件最终位于 S3 存储桶的顶层。如何将它们添加到子目录?例如,我的旧回形针配置可以按型号名称在目录中分类。

你不能。那时,has_one_attachedhas_many_attached 宏只有一个可能的选择,即 :dependenthttps://github.com/rails/rails/blob/master/activestorage/lib/active_storage/attached/macros.rb#L30

看到(也许是你投反对票的原因,但它是关于 "direct" 上传所以...):。 回复来自Active Storage的主要维护者。