How can I set paperclip's storage mechanism based on the current Rails environment?

后端 未结 7 1370
野性不改
野性不改 2020-12-12 11:07

I have a rails application that has multiple models with paperclip attachments that are all uploaded to S3. This app also has a large test suite that is run quite often. Th

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 11:34

    Use the :rails_env interpolation when you define the attachment path:

    has_attached_file :attachment, :path => ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
    

提交回复
热议问题