配置 Shrine 文件 ID 属性的生成方式 gem

Configure the way file ID attribute is generated on Shrine gem

Shrine 在调用 presign_endpoint 时为上传到 AWS S3 的文件创建随机 ID。有没有办法改变使用 Shrine 的配置生成 ID 的方式?

是的,您可以使用 :presign_location:

Shrine.plugin :presign_endopint, presign_location: -> (request) do
  "#{SecureRandom.hex}/#{request.params["filename"]}" # for example
end