store images locally for development s3 for production Rails Paperclip

前端 未结 3 1145
花落未央
花落未央 2021-02-18 15:24

I want to upload images on my local machine for development but store them on my Amazon S3 account for production.

upload.rb

if Rails.env.development?
           


        
3条回答
  •  無奈伤痛
    2021-02-18 15:45

    One more solution is to move the hash with params to constants, which will be defined in config/environments/*.rb files. Then you can just use

    has_attached_file :proto, PAPERCLIP_STORAGE_OPTS
    

    Using if/unless in model while defining methods is a bit messy I think

提交回复
热议问题