Carrierwave multiple uploads fails with mount_uploaders

I'm using a new way to add multiple files with carrierware as describle here: https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads

When I try save the object I got this error:

Invalid JSON text: "Invalid value." at position 1 in value (or column) '---
- photo1.jpg
- photo2.jpg
'.

Using: Rails 4.2.1 MySQL 5.7.10 Ruby 2.2.2

Does anyone know what can it be?

--

I fix it migrating my project from MySQL to PostgreSQL.

Answers


I had the same problem here on mysql and rails 4 with Carrierwave multiple upload files(images here), I added this to my model.rb:

serialize :menu_images, JSON

under the

mount_uploaders :menu_images, AvatarUploader

of course :menu_images is the column name for multiple files. It fixed the problem, no need to change the database.

Sincerely yours.


You were probably reading the carrierwave documentation on the master branch on github.

If you have the following in your Gemfile:

gem 'carrierwave'

Then at the time of writing you would have carrierwave 0.11.2 installed.

The mount_uploaders method is not available in this version, it is currently on the master branch.

If you want to you want to use this method, you should add this line to your Gemfile instead:

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

This will fix your issue.


Need Your Help

Uploading image to icloud using cloud kit throws error ios

ios swift uiimage icloud cloudkit

I am facing one issue. Error is thrown when image is uploaded to icloud using cloud kit. It throws following error: