Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
enoonan committed Nov 25, 2024
1 parent 5fe0325 commit a8a9439
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/ash_state_machine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ defmodule AshStateMachine do
Ash.Changeset.add_error(other, "Can't transition states on destroy actions")
end

defp invalid_initial_state(changeset, target) do
changeset
|> Ash.Changeset.set_context(%{state_machine: %{attempted_change: target}})
|> Ash.Changeset.add_error(
AshStateMachine.Errors.InvalidInitialState.exception(
target: target,
action: changeset.action.name
)
)
end

defp find_and_perform_transition(changeset, old_state, attribute, target) do
changeset.resource
|> AshStateMachine.Info.state_machine_transitions(changeset.action.name)
Expand Down Expand Up @@ -223,6 +212,17 @@ defmodule AshStateMachine do
)
end

defp invalid_initial_state(changeset, target) do
changeset
|> Ash.Changeset.set_context(%{state_machine: %{attempted_change: target}})
|> Ash.Changeset.add_error(
AshStateMachine.Errors.InvalidInitialState.exception(
target: target,
action: changeset.action.name
)
)
end

@doc """
A reusable helper which returns all possible next states for a record
(regardless of action).
Expand Down

0 comments on commit a8a9439

Please sign in to comment.