Skip to content
Fork of acts_as_state_machine plugin for Rails
Latest commit ee5b41f Apr 13, 2008 Dray Lacy Added a :value argument to the state macro, allowing you to specify a…
… custom value which will be used to refer to the state in the database. This is especially useful for integrating acts_as_state_machine with a legacy database.


= Acts As State Machine

This act gives an Active Record model the ability to act as a finite state
machine (FSM).

Acquire via subversion at:

If prompted, use the user/pass anonymous/anonymous.

== Example

 class Order < ActiveRecord::Base
   acts_as_state_machine :initial => :opened

   state :opened
   state :closed, :enter => {|o| Mailer.send_notice(o)}
   state :returned

   event :close do
     transitions :to => :closed, :from => :opened

   event :return do
     transitions :to => :returned, :from => :closed

 o = Order.create
 o.close! # notice is sent by mailer

Something went wrong with that request. Please try again.