What is the difference between `Ash.Changeset.for_action` and `Ash.Changeset.for_*`?

The different for_* actions require a specific action atom (i.e. |> for_create(:create, opts) ), so what’s the point of these explicit functions?

The example might not be the best, the atom is the name of the create action, and the name in the function is the action type. You can have multiple create actions with different names e.g:

actions do
  create :new do
  create :upsert do
    upsert? true

then you would use |> for_create(:new, ...) and |> for_create(:upsert, ...)

1 Like

Ah, so it’s the same idea as the Multi actions, got it :+1:

Wait no, that’s not right. The :create action in my case would likely refer to the defaults [:create] in my resource I take it?

yes, exactly