2017-02-12 58 views
0

我是新來的回形針。我可以在s3中存儲。但它實際上存儲在'journal/cover_images/000/000/001/original/download.png'中。如何將路徑更改爲自定義路徑。回形針 - 存儲在S3中的自定義文件夾中

在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 

})

如何更改路徑中提到的路徑:網址是什麼?

回答

0

在paper_clip.rb文件中,添加了這兩行。

 :url => "/journals/static_cover_images/:basename.:extension", 
     :path => "/journals/static_cover_images/:basename.:extension"` 

This Works !.

相關問題