I am trying to use Ecto.Enum in polymorphic embed. In case of normal schema, Ecto.Enum can be used as follows
@types [
embed_comment: EmbedComment,
serial_comment: SerialComment
]
schema "posts" do
field :name, :string
field :type, Ecto.Enum, values: @types`
timestamps()
end
But in the below scenario, can I know what is the right syntax to use Ecto.Enum?
@types [
embed_comment: EmbedComment,
serial_comment: SerialComment
]
schema "posts" do
field :name, :string
field :nodes, {:array, PolymorphicEmbed},
types: ???
timestamps()
end
Any suggestions appreciated. Thank you