mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-10 22:52:37 +01:00
Updated to svn tags/tracks-1.6
This commit is contained in:
parent
103fcb8049
commit
02496f2d44
2274 changed files with 0 additions and 0 deletions
33
vendor/plugins/acts_as_state_machine/README
vendored
Normal file
33
vendor/plugins/acts_as_state_machine/README
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
= 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!
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue