public
Rubygem
Description: Adds support for creating state machines for attributes on any Ruby class
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/state_machine.git
Fix state machine examples in README to match output. [#2 state:resolved]
obrie (author)
Sat Oct 04 15:21:36 -0700 2008
commit  c02e3dc02b1a6749a571652e0ba3ad9572658be8
tree    1a9b97a2e5e517128b3bfc22b6959d76ee631764
parent  a3cbd3308f37deb083d277c1b253837e93e3407a
...
44
45
46
47
 
48
49
50
...
127
128
129
130
 
131
132
133
...
44
45
46
 
47
48
49
50
...
127
128
129
 
130
131
132
133
0
@@ -44,7 +44,7 @@ Below is an example of many of the features offered by this plugin, including
0
 * Conditional transitions
0
 
0
   class Vehicle < ActiveRecord::Base
0
-    state_machine :state, :initial => 'idling' do
0
+    state_machine :state, :initial => 'parked' do
0
       before_transition :from => %w(parked idling), :do => :put_on_seatbelt
0
       after_transition :to => 'parked', :do => lambda {|vehicle| vehicle.update_attribute(:seatbelt_on, false)}
0
       after_transition :on => 'crash', :do => :tow!
0
@@ -127,7 +127,7 @@ states can be transparently stored using record ids in the database like so:
0
   class Vehicle < ActiveRecord::Base
0
     belongs_to :state, :class_name => 'VehicleState'
0
     
0
-    state_machine :state, :initial => 'idling' do
0
+    state_machine :state, :initial => 'parked' do
0
       ...
0
       
0
       event :park do

Comments