我正在使用红宝石 AASM 宝石。
有谁知道跳过状态的正确方法是什么?
class Job
# ...
event :stage1_completed do
if stage2_completed?
transitions from: :stage1, :to => :stage3
else
transitions from: :stage1, :to => :stage2
end
end
# ...
end
在 AASM 中进行设置的最佳方法是什么?
我在一组 resque 作业中使用此代码,因此 stage1 是一个 resque 作业,然后更新状态并开始完成下一个 resque 作业。阶段2相同,然后阶段3