public
Description: Fork of acts_as_state_machine plugin for Rails
Clone URL: git://github.com/omghax/acts_as_state_machine.git
Search Repo:
name age message
folder .gitignore Wed Apr 09 12:03:57 -0700 2008 Added .gitignore. [omghax]
folder CHANGELOG Mon Nov 13 05:47:36 -0800 2006 break with true value [Kaspar Schiess] [sbarron]
folder MIT-LICENSE Sun Jan 15 09:08:57 -0800 2006 git-svn-id: http://elitists.textdriven.com/svn/... [sbarron]
folder README Fri Jan 20 16:34:14 -0800 2006 git-svn-id: http://elitists.textdriven.com/svn/... [sbarron]
folder Rakefile Fri Apr 11 12:03:18 -0700 2008 Fixed :test rake task so that it uses the corre... [omghax]
folder TODO Fri Jan 20 12:25:05 -0800 2006 git-svn-id: http://elitists.textdriven.com/svn/... [sbarron]
folder init.rb Fri Jul 14 07:50:09 -0700 2006 git-svn-id: http://elitists.textdriven.com/svn/... [sbarron]
folder lib/ Sat Apr 12 23:45:28 -0700 2008 Added a :value argument to the state macro, all... [omghax]
folder test/ Sat Apr 12 23:45:28 -0700 2008 Added a :value argument to the state macro, all... [omghax]
README
= 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!