在我們rails 3.2應用程式寶石workflow,所述workflow被定義爲這樣的: workflow do
state :new do
event :submit, :transitions_to => :being_reviewed
end
state :being_reviewed do
event :approve,
在我們的rails應用程序中,某些model可能需要approval process。例如,對於purchasing order (PO),通常從提交PO開始,然後經理批准並且首席執行官批准PO可以發送給供應商。審批程序可能是預定義的。隨着approval process,我們也想爲每一個過渡記錄數據: 1. who did it (use id),
2. when she/he did
Worflow是一款狀態機紅寶石寶石。以下是其在github上的文檔的代碼示例: class Article
include Workflow
workflow do
state :new do
event :submit, :transitions_to => :awaiting_review
end
state :awaiting_