Tuesday 15 May 2012

ruby - How to skip a state in a state machine using AASM -



ruby - How to skip a state in a state machine using AASM -

i'm using ruby aasm gem.

does know right way skip state is?

class job # ... event :stage1_completed if stage2_completed? transitions from: :stage1, :to => :stage3 else transitions from: :stage1, :to => :stage2 end end # ... end

what best way set in aasm?

i using code in set of resque jobs, stage1 resque job, updates state , starts next resque job done. same stage2, stage3

you utilize guards.

event :stage1_completed transitions from: :stage1, :to => :stage3, :guard => :stage2_completed? end

ruby aasm

No comments:

Post a Comment