Workaround for CarrierWave multiple file upload using sqlite3 in development

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 02:52:23

问题


In my team development environment, we are using sqlite3 which comes default in Rails.

However, carrierwave's implementation of multi files upload require database that supports array/json datatype.

Are there any workaround so that it will work on our development environment without installing other database such as postgres?

I'm following the instructions over here https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads


回答1:


The only possible workaround would be to create a separate model for the uploads:

class ImagesContainer
  has_many :uploads
end

class Upload
  mount_uploader :image, ImageUploader

  belongs_to ImagesContainer
end


来源:https://stackoverflow.com/questions/30951168/workaround-for-carrierwave-multiple-file-upload-using-sqlite3-in-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!