diff --git a/lib/ash/changeset/changeset.ex b/lib/ash/changeset/changeset.ex index e7acd9db..f79b60ba 100644 --- a/lib/ash/changeset/changeset.ex +++ b/lib/ash/changeset/changeset.ex @@ -1251,6 +1251,19 @@ defmodule Ash.Changeset do other -> other end + case action do + %Ash.Resource.Actions.Update{name: name} -> + raise ArgumentError, + message: """ + Action #{inspect(changeset.resource)}.#{name} was passed to `Ash.Changeset.for_create`, but it is an update action. + + Perhaps you meant to call `Ash.Changeset.for_create` instead? + """ + + _ -> + :ok + end + changeset |> set_context(%{ private: %{ diff --git a/test/actions/load_test.exs b/test/actions/load_test.exs index 6c3839cc..d1eb95d7 100644 --- a/test/actions/load_test.exs +++ b/test/actions/load_test.exs @@ -709,8 +709,7 @@ defmodule Ash.Test.Actions.LoadTest do |> Ash.Query.load([:posts, :latest_post]) |> Ash.read!(authorize?: true) - author = - Ash.load!(author, [:posts, :latest_post], lazy?: true) + Ash.load!(author, [:posts, :latest_post], lazy?: true) end test "loading something already loaded still loads it unless lazy?: true" do