0
我想添加在我的用户表中的一个列中,该列记录了有关用户在数据库中存储的数组中的用户信息。每一次,我尝试运行此迁移我做:Rails错误:“无法引用数组”
class AddLoggingToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :session_log, :string, array: true, default: [:username, :ip, :time, :user_agent]
end
end
然后我在控制台中得到这个错误:
-- add_column(:users, :session_log, :string, {:array=>true, :default=>[:username, :ip, :time, :user_agent]})
rails aborted!
StandardError: An error has occurred, all later migrations canceled:
can't quote Array
上什么可能会错误的任何想法?
发现默认选项导致问题,为什么这是明确的? – RushRed