Since Rails >= 4.0 adds support for PostgreSQL array data types I was wondering if anyone already played with carrierwave attachments mounted to array attributes instead of join tables when a model should have multiple attachments.
What I got in mind is something like
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
Check https://github.com/carrierwaveuploader/carrierwave/issues/1548
switch to the github version of the carrierwave gem
gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'
Use mount_uploaders instead of mount_uploader in your class as described in the carrierwave wiki.
mount_uploaders :pictures, PictureUploader
remove the, array:true at the end of the mount_uploader.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With