mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: allow_nil?: false + default interaction
This commit is contained in:
parent
a33e0b97b9
commit
f6026c6895
2 changed files with 4 additions and 3 deletions
|
@ -706,7 +706,7 @@ defmodule Ash.Changeset do
|
|||
|
||||
Enum.reduce(attributes, changeset, fn required_attribute, changeset ->
|
||||
if Ash.Changeset.changing_attribute?(changeset, required_attribute.name) ||
|
||||
required_attribute.default do
|
||||
not is_nil(required_attribute.default) do
|
||||
changeset
|
||||
else
|
||||
Ash.Changeset.add_error(
|
||||
|
@ -730,8 +730,7 @@ defmodule Ash.Changeset do
|
|||
end
|
||||
|
||||
Enum.reduce(attributes, changeset, fn required_attribute, changeset ->
|
||||
if Ash.Changeset.changing_attribute?(changeset, required_attribute.name) ||
|
||||
required_attribute.default do
|
||||
if Ash.Changeset.changing_attribute?(changeset, required_attribute.name) do
|
||||
if get_attribute(changeset, required_attribute.name) do
|
||||
changeset
|
||||
else
|
||||
|
|
|
@ -155,6 +155,8 @@ defmodule Ash.Test.Actions.CreateTest do
|
|||
attribute(:list_attribute, {:array, :integer})
|
||||
attribute(:date, :date)
|
||||
attribute(:binary, :binary)
|
||||
attribute(:required_with_default, :string, allow_nil?: false, default: "string")
|
||||
attribute(:required_boolean_with_default, :boolean, allow_nil?: false, default: false)
|
||||
|
||||
attribute(:list_attribute_with_constraints, {:array, :integer},
|
||||
constraints: [
|
||||
|
|
Loading…
Reference in a new issue