No such input `xxxxx` for action ResourceName1.create

In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there an option to make it ignore the extra_key instead?

create :create do
    accept [:name, :age]
..

ResourceName1
|> Ash.Changeset.for_create(:create, %{name: "John", age: 20, extra_key: 1234})
|> Ash.create!()

There is the skip_unknown_inputs option

https://hexdocs.pm/ash/Ash.Changeset.html#for_create/4-opts

ResourceName1
|> Ash.Changeset.for_create(:create, %{name: "John", age: 20, extra_key: 1234}, skip_unknown_inputs: [:extra_key])
|> Ash.create!()
3 Likes

Thank you, Barnabas! I must have overlooked it from the documentation.