Is there a reasonable way to support implicit state transitions and their associated rules/callbacks using Workflow?
As a simple example:
class Article
include Workflow
workflow do
state :new do
event :submit, :transitions_to => :awaiting_review
end
state :awaiting_review do
event :review, :transitions_to => :being_reviewed
end
state :being_reviewed do
event :accept, :transitions_to => :accepted
event :reject, :transitions_to => :rejected
end
state :accepted
state :rejected
end
...
end
If I have an AR Article model whose state is new, and attempt to update the workflow_state property to accepted I would expect the transition to be rejected identically to how it would be if I called article.accept!, however I find that the model is persisted with the state accepted even though this was not a valid transition.
Is there a reasonable way to support implicit state transitions and their associated rules/callbacks using Workflow?
As a simple example:
If I have an AR Article model whose state is
new
, and attempt to update theworkflow_state
property toaccepted
I would expect the transition to be rejected identically to how it would be if I calledarticle.accept!
, however I find that the model is persisted with the stateaccepted
even though this was not a valid transition.