Ecto 3.6, Ecto_sql 3.6 also
My User data-module:
# [........]
@changeset_fields [
:a,
:b,
:c
]
def changeset(this, params \\ %{}) do
cast(this, params, @changeset_fields)
|> validate_required([
:email,
])
end
migration:
defmodule MyAp.Repo.Migrations.CreateUsers do
use Ecto.Migration
def change do
create table(:users) do
# [......]
timestamps()
end
# [......]
And whenever I’m trying to insert a new user:
a1 = Repo.insert!(User.changeset(%User{}, %{
email: "email",
status: :active,
confirmed_at: DateTime.utc_now()
}))
it’ll always throw an exception:
** (ArgumentError) cast/3 expects a list of atom keys, got: `{:updated_at, :naive_datetime}`
(ecto 3.6.2) lib/ecto/changeset.ex:563: Ecto.Changeset.cast_key/1
(ecto 3.6.2) lib/ecto/changeset.ex:521: Ecto.Changeset.process_param/7
(elixir 1.11.3) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto 3.6.2) lib/ecto/changeset.ex:508: Ecto.Changeset.cast/6
(my_app 0.1.2) lib/user.ex:42: MyApp.User.changeset/2
this happens only in User module, and in others not, although User is almost identical to other data-modules.
What’s the matter?