[英]Paperclip - Store in Custom Folder in S3
I am new to paperclip. 我是回形针的新手。 I am able to store in s3.
我能够存储在s3中。 But it is actually storing in 'journals/cover_images/000/000/001/original/download.png'.
但实际上它存储在“ journals / cover_images / 000/000/001 / original / download.png”中。 How do I change the path to custom path.
如何将路径更改为自定义路径。
In paper_clip.rb 在paper_clip.rb中
Paperclip::Attachment.default_options.merge!({
# :url => "#{bucket_name}/static_cover_images/#{Customer.first.symbol}/:id/:style/:basename.:extension",
# :path => ":rails_root/public:url"
storage: :s3,
s3_credentials: {
bucket: bucket_name,
access_key_id: 'xxxxxxxxxxxxxx',
secret_access_key: 'yyyyyyyyyyyyyyyyyyyyyyy',
s3_region: 'mx-east-3'
},
key: custom_path
}) })
How do I change the path to the path mentioned in :url? 如何将路径更改为:url中提到的路径?
In paper_clip.rb file, added these two lines. 在paper_clip.rb文件中,添加了这两行。
:url => "/journals/static_cover_images/:basename.:extension",
:path => "/journals/static_cover_images/:basename.:extension"`
This works!. 这有效!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.