Closed MathieuDerelle closed 5 years ago
You can put this line into every state definition
event :invalid, transitions_to: :reject
Or, just define a plain method, so you can call it any time
def invalid!
# do whatever is needed, e.g. depending on `current_state`
...
# persist the rejected state
persist_workflow_state :reject
end
...
article.invalid!
Note on style: I would give a noun name to a state, like rejected
, not reject
and give an event a verb name, e.g. invalidate
.
Is there a way to define an event accessible from any state ?
I've tried
but it doesn't seem to work
If it's not supported now, could it be done in the future please ?