由于Rails> = 4.0添加了
support for PostgreSQL array data types,我想知道当模型应该有多个附件时,是否有人已经使用
carrierwave附件安装到数组属性而不是连接表.
我想到的是类似的东西
class AddPicturesToUser < ActiveRecord::Migration def change add_column :users,:pictures,:text,array: true end end class User < ActiveRecord::Base mount_uploader :pictures,PictureUploader,array: true end
检查
https://github.com/carrierwaveuploader/carrierwave/issues/1548
原文链接:https://www.f2er.com/postgresql/192035.html切换到carrierwave gem的github版本
gem’carrierwave’,github:’carrierwaveuploader / carrierwave’
如carrierwave wiki中所述,在类中使用mount_uploaders而不是mount_uploader.
mount_uploaders:图片,PictureUploader
在mount_uploader的末尾删除,array:true.