When I try to migrate this:
class CreateTasks < ActiveRecord::Migration[5.0]
def change
create_table :tasks do |t|
t.string :category
t.string :text
t.string :asset_name
t.string :correct_answers, array:true, default: []
t.string :wrong_answers, array:true, default: []
t.integer :score
t.timestamps
end
end
end
I get error:
== 20161217135738 CreateTasks: migrating ====================================== -- create_table(:tasks) rails aborted! StandardError: An error has occurred, this and all later migrations canceled:
can't quote Array
I am using rails 5 and mysql on development. Any idea how to solve that problem?
If you want support all databases you must serialize the array in a String I am giving you an example