私はHerokuのRailsアプリケーションの新しい移行を作成しました。それはこのようにいくつかの配列の列を追加します。Rails Postgreの問題:不正な配列リテラル、配列値が "{"またはディメンション情報で始まる必要があります
t.string :timezone, array: true, default: [].to_yaml
t.string :locale, array: true, default: [].to_yaml
私が移行しようとすると、私は次のエラーを取得する:StackOverflowの上
class Filter < ApplicationRecord
belongs_to :letter
serialize :timezone
serialize :locale
serialize :segment
validates_uniqueness_of :letter_id
end
一部の人々は言う:ここ
は私のモデルであり、シリアライズを削除するとそのトリックが実行されますが、文字列ではなく配列を格納する必要があります。ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR: malformed array literal: "--- [] " DETAIL: Array value must start with "{" or dimension information. : CREATE TABLE "filters" ("id" serial primary key, "letter_id" integer, "gender" character varying, "timezone" character varying[] DEFAULT '--- [] ', "locale" character varying[] DEFAULT '--- []
どうすればこの問題を解決できますか?