Stateflow

PLEASE NOTE!!!

*Version 0.5.x > will only support Rails 3 / ActiveModel persistences.
If you are using Rails 2 Please make sure you use the 0.4.x releases. There
is a branch dedicated to that.*

This is the basics of the gem. Please check out the examples directory or
tests for usage until this README gets fleshed out. Feel free to fork and
modify as you please.

INSTALL

gem install stateflow

Usage

As you can see below, Stateflow's API is very similar to AASM, but
allows for a more dynamic state transition flow. Stateflow supports
persistence/storage with Mongoid, MongoMapper, and ActiveRecord. Request
any others or push them to me.

Stateflow defaults to ActiveRecord but you can set the persistence layer
with:

Stateflow.persistence = :mongo_mapper

OR

Stateflow.persistence = :active_record

OR

Stateflow.persistence = :mongoid

Stateflow allows dynamic :to transitions with :decide. The result :decide
returns needs to be one of the states listed in the :to array, otherwise it
wont allow the transition. Please view the advanced example below for
usage.

You can set the default column with the state_column function in the
stateflow block. The default state column is “state”.

state_column :state

Rails 3

Stateflow now automatically tries to detect your persistence from your applications default ORM config. If the ORM you are using does not have a persistence layer it will default to ActiveRecord.