Skip to content
Fork of acts_as_state_machine plugin for Rails
Ruby
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.
Failed to load latest commit information.
lib
test
.gitignore Added .gitignore. Apr 9, 2008
CHANGELOG
MIT-LICENSE git-svn-id: http://elitists.textdriven.com/svn/plugins/acts_as_state_… Jan 15, 2006
README git-svn-id: http://elitists.textdriven.com/svn/plugins/acts_as_state_… Jan 21, 2006
Rakefile
TODO git-svn-id: http://elitists.textdriven.com/svn/plugins/acts_as_state_… Jan 20, 2006
init.rb git-svn-id: http://elitists.textdriven.com/svn/plugins/acts_as_state_… Jul 14, 2006

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!

Something went wrong with that request. Please try again.