tracks/vendor/plugins/acts_as_state_machine
2008-05-20 21:28:26 +01:00
..
lib Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
test Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
CHANGELOG Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
init.rb Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
MIT-LICENSE Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
Rakefile Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
README Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00
TODO Removed superfluous 'tracks' directory at the root of the repository. 2008-05-20 21:28:26 +01:00

= 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:

http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk

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

== Example

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

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

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

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

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