[Ruby] acts_as_state_machine question

Geoffrey Grosenbach boss at topfunky.com
Thu Nov 2 13:43:37 PST 2006


On Nov 2, 2006, at 1:35 PM, Frederick Alger wrote:
> acts_as_state_machine sets the initial state in before_create, so I
> tried using Order.create instead of Order.new, with the same result.

I'm using it in a project and have passing unit tests.

* As mentioned, state is not set until create, so use Order.create
* I believe the syntax is to list states separately on lines by  
themselves (that's how I use it).

   state :new
   state :placed
   state :confirmed
   ... etc.

This is because the second argument to state can be a callback method.

Documentation is slim and the plugin hasn't been updated much.  
However, it has a good set of features and many people are using it.


Geoff



More information about the Ruby mailing list