chore: hotfix code_interface change

This commit is contained in:
Zach Daniel 2022-11-29 16:21:53 -05:00
parent ba0c0a0d25
commit 113b8740d4

View file

@ -20,15 +20,15 @@ defmodule Ash.CodeInterface do
@doc false
def default_value(resource, action, key) do
field =
{field_type, field} =
case Enum.find(action.arguments, fn argument ->
argument.name == key
end) do
nil ->
Ash.Resource.Info.attribute(resource, key)
{:attribute, Ash.Resource.Info.attribute(resource, key)}
argument ->
argument
{:argument, argument}
end
if !field.allow_nil? do
@ -36,6 +36,9 @@ defmodule Ash.CodeInterface do
end
default =
if field_type == :argument do
field.default
else
if action.type == :update || (action.type == :destroy && action.soft?) do
if is_nil(action.update_default) do
field.default
@ -45,6 +48,7 @@ defmodule Ash.CodeInterface do
else
field.default
end
end
if is_function(default) do
quote do