开发者

Multiple storage types with paperclip gem

开发者 https://www.devze.com 2023-04-12 09:17 出处:网络
Is it possible to have multiple storage types with the Paperclip gem? I need to be able to POST a file that a user has uploaded. Currently I am using :s3 storage option. This seems like there is extr

Is it possible to have multiple storage types with the Paperclip gem?

I need to be able to POST a file that a user has uploaded. Currently I am using :s3 storage option. This seems like there is extra bandwidth up and down that could b开发者_开发问答e avoided if I put the file in :rails_root/tmp.


You can use the gem 'paperclip-storage-tmp'

his gem allows you to configure Paperclip 2.x to use your temporary directory to store the attachments.

once you have it on your project this you can do something like

class User < ActiveRecord::Base
  has_attached_file :avatar, storage: :tmp
end
0

精彩评论

暂无评论...
验证码 换一张
取 消