Carrierwave set to Rails 4 PostgreSQL array attribute

Since Rails> = 4.0 adds support for PostgreSQL array data types, I was wondering if someone had already played with carrierwave attached to array attributes instead of join tables when the model should have multiple attachments.

What I meant 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 
+8
postgresql ruby-on-rails-4 carrierwave
source share
1 answer

Check out https://github.com/carrierwaveuploader/carrierwave/issues/1548

switch to the github version of the carrier wave tow

gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'

Use mount_uploaders instead of mount_uploader in your class, as described in the wiki browser.

mount_uploaders :pictures, PictureUploader

remove the array array: true at the end of mount_uploader.

+1
source share

All Articles