Skip to content

Commit

Permalink
Add :array example to Ecto.Enum docs (#3437)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdugan3 committed Oct 7, 2020
1 parent 14bafd4 commit bc43a3f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ecto/enum.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ defmodule Ecto.Enum do
field :status, Ecto.Enum, values: [:foo, :bar, :baz]
Composite types, such as `:array`, are also supported:
field :roles, {:array, Ecto.Enum}, values: [:Author, :Editor, :Admin]
`:values` must be a list of atoms. String values will be cast to atoms safely
and only if the atom exists in the list (otherwise an error will be raised).
Attempting to load any string not represented by an atom in the list will be
Expand Down

0 comments on commit bc43a3f

Please sign in to comment.