[Ruby] acts_as_state_machine question

Frederick Alger fred at fredalger.net
Thu Nov 2 13:47:14 PST 2006


Thanks for the quick reply, Geoff!

I'm glad to hear that people are using this thing, and it works for  
them.

I did simplify my state declarations before posting; and each has  
Proc which triggers e-mails as the order progresses through the  
system, one state per line.  I'm going to make my Order class as  
simple as possible, use create, and then try again.

Cheers,
- Fred.

On Nov 2, 2006, at 1:43 PM, Geoffrey Grosenbach wrote:

> 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
>
> _______________________________________________
> Ruby at zenspider.com
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby



More information about the Ruby mailing list