improvement: properly honor ecto type init callback

This commit is contained in:
Zach Daniel 2023-10-17 13:39:21 -04:00
parent d9bacc1554
commit 5d85c5be14
2 changed files with 8 additions and 3 deletions

View file

@ -38,7 +38,9 @@ defmodule Ash.Type.DateTime do
storage_type
end
def storage_type(_), do: :utc_datetime
def storage_type(_constraints) do
:utc_datetime
end
@impl true
def generator(_constraints) do

View file

@ -949,9 +949,12 @@ defmodule Ash.Type do
def init(opts) do
constraints = @parent.constraints()
{:ok, opts} =
opts
|> Keyword.take(Keyword.keys(constraints))
|> @parent.init()
opts
|> Keyword.take(Keyword.keys(constraints))
|> @parent.init()
end
@impl true