Skip to content

Commit

Permalink
chore: handle nil action in atomic_update
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Oct 13, 2024
1 parent 716ea01 commit ee50939
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ash/changeset/changeset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,11 @@ defmodule Ash.Changeset do

{:ok, value} ->
allow_nil? =
attribute.allow_nil? and attribute.name not in changeset.action.require_attributes
if is_nil(changeset.action) do
true
else
attribute.allow_nil? and attribute.name not in changeset.action.require_attributes
end

if is_nil(value) and !allow_nil? do
add_required_attribute_error(changeset, attribute)
Expand All @@ -1707,8 +1711,7 @@ defmodule Ash.Changeset do
changeset
else
allow_nil? =
attribute.allow_nil? and
(is_nil(changeset.action) || attribute.name not in changeset.action.require_attributes)
attribute.allow_nil? and attribute.name not in changeset.action.require_attributes

value =
if allow_nil? || not Ash.Expr.can_return_nil?(value) do
Expand Down

0 comments on commit ee50939

Please sign in to comment.