This is the second time implementing this stuff on a project. The first time, I had no problem.
This time I experienced an error (something probably changed in Ecto).
I thought I should add this in case someone else runs into this problem.
In chapter 2, page 11, the following code produced an error:
defmodule Meow.EctoHelper do
def enum(values) do
{:parameterized, Ecto.Enum, Ecto.Enum.init(values: values)}
end
end
After reading the Ecto doc (Ecto.Changeset — Ecto v3.12.4), I got it to work by replacing
{:parameterized, Ecto.Enum, Ecto.Enum.init(values: values)}
with
Ecto.ParameterizedType.init(Ecto.Enum, values: values)
Working module
defmodule Meow.EctoHelper do
def enum(values) do
Ecto.ParameterizedType.init(Ecto.Enum, values: values)
end
end
Using Elixir 1.16, Ecto 3.12