class AddLikesCountAndLikedUserIdsToReplies < ActiveRecord::Migration
def change
add_column(:replies, :likes_count, :integer, default: 0)
add_column(:replies, :liked_user_ids, :integer, default: [], array: true)
end
end
我想通过上面这段代码将 liked_user_ids 字段保存为数组 Array 类型,结果
create_table "replies", force: :cascade do |t|
t.integer "user_id", null: false
t.integer "plan_id", null: false
t.text "body", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "likes_count", default: 0
t.integer "liked_user_ids" # 这里并没有反应
end
怎么解决呢?