AshWorkflow.Changes.RefuseStaleTransition (AshWorkflow v0.8.0)

Copy Markdown View Source

Refuses a transition built from a stale record: the update writes only if the row still holds the values the transition decided from.

The values are the state attribute and every attribute of the resource that the routes of the loaded step read. When the row no longer holds one of them, the update fails with Ash.Error.Changes.StaleRecord and the row is left as it was.

An attribute the call supplies through the transition's accept is not pinned, since a route reads the supplied value, not the loaded one. References through a relationship, and calculations or aggregates, are not pinned: they are not values on the row.

On a data layer that cannot filter an update, such as Ash.DataLayer.Simple, Ash.Changeset.filter/2 drops the filter, so nothing is pinned.

AshWorkflow.Transformers.AddActions adds it to each manual transition and to undo. Not intended for direct use.