From b9eb641040975f376a330b6ab625f331545dc7c9 Mon Sep 17 00:00:00 2001 From: Dmitry Maganov Date: Tue, 5 Nov 2024 20:07:28 +0200 Subject: [PATCH] fix: properly handle `changing_attributes` check with `from` in create --- lib/ash/policy/check/changing_attributes.ex | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/ash/policy/check/changing_attributes.ex b/lib/ash/policy/check/changing_attributes.ex index c2f47bd40..c4c52150c 100644 --- a/lib/ash/policy/check/changing_attributes.ex +++ b/lib/ash/policy/check/changing_attributes.ex @@ -29,11 +29,7 @@ defmodule Ash.Policy.Check.ChangingAttributes do def filter(_actor, %{changeset: %Ash.Changeset{} = changeset}, options) do Enum.reduce_while(options[:changing], true, fn {attribute, opts}, expr -> if Keyword.has_key?(opts, :from) && changeset.action_type == :create do - if opts[:from] == nil do - {:halt, false} - else - {:cont, expr} - end + {:halt, false} else if Ash.Changeset.changing_attribute?(changeset, attribute) do case {Keyword.fetch(opts, :from), Keyword.fetch(opts, :to)} do