【问题标题】:Configure the way file ID attribute is generated on Shrine gem配置在 Shrine gem 上生成文件 ID 属性的方式
【发布时间】:2020-02-13 06:14:47
【问题描述】:

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

【问题讨论】:

    标签: ruby-on-rails ruby amazon-s3 shrine


    【解决方案1】:

    是的,你可以使用:presign_location

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-30
      • 2022-01-15
      • 2020-12-14
      • 2019-10-23
      • 1970-01-01
      • 2016-09-25
      • 1970-01-01
      相关资源
      最近更新 更多