Skip to content

Commit

Permalink
improvement: properly honor ecto type init callback
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Oct 17, 2023
1 parent d9bacc1 commit 5d85c5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/ash/type/datetime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions lib/ash/type/type.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5d85c5b

Please sign in to comment.