Paperclip and Amazon S3 how to do paths?

后端 未结 2 497
既然无缘
既然无缘 2021-02-13 03:56

How do I create paths with paperclip when using Amazon S3?

My directory on my bucket is:

/image/:id/:filename

My model:



        
2条回答
  •  生来不讨喜
    2021-02-13 04:41

    Try this:

      has_attached_file :image,
        :storage => :s3,
        :bucket => 'mybucket',
        :path => "/image/:id/:filename",
        :s3_credentials => {
          :access_key_id => ENV['S3_KEY'],
          :secret_access_key => ENV['S3_SECRET']
        }
    

提交回复
热议问题