我正在关注载波文档here以将多个图像上传到我的列表模型。 时,我用在使用载波宝石在轨中尝试多个图像上载时的Mysql语法错误
rails g migration add_images_to_listings images:json
迁移被成功地这样创建的命令 -
class AddImagesToListings < ActiveRecord::Migration
def change
add_column :listings, :images, :json
end
end
但运行耙分贝:迁移抛出一个MySQL的语法错误
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'json'
at line 1: ALTER TABLE `listings` ADD `images` json/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'
我怀疑这是因为json数据类型不被mysql支持。有一些解决方法吗?
正如我见[这里](http://stackoverflow.com/a/17918118/2968762),你可以使用JSON数据类型与PostgreSQL – Abhi