sudothinker / acts_as_state_machine forked from freels/acts_as_state_machine
- Source
- Commits
- Network (12)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
5a4cee3
| name | age | message | |
|---|---|---|---|
| |
CHANGELOG | Wed Mar 04 21:56:24 -0800 2009 | |
| |
MIT-LICENSE | Sun Jan 15 09:08:57 -0800 2006 | |
| |
README | Thu Mar 05 09:50:29 -0800 2009 | |
| |
Rakefile | Sun Jan 15 09:29:13 -0800 2006 | |
| |
TODO | Fri Jan 20 12:25:05 -0800 2006 | |
| |
init.rb | Fri Jul 14 07:50:09 -0700 2006 | |
| |
lib/ | Thu Mar 05 10:16:07 -0800 2009 | |
| |
test/ | Thu Mar 05 10:16:07 -0800 2009 |
README
= Acts As State Machine This act gives an Active Record model the ability to act as a finite state machine (FSM). Acquire via git at: http://github.com/sudothinker/acts_as_state_machine.git Original repository available 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, :on_transition => :email_user end protected def email_user Notifier.deliver_order_returned(self) end end o = Order.create o.close! # notice is sent by mailer o.return!
