Skip to content

Commit

Permalink
fix: properly handle changing_attributes check with from in create (
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam authored Nov 5, 2024
1 parent 2db928f commit 0ea315a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/ash/policy/check/changing_attributes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0ea315a

Please sign in to comment.