ministry_of_state

Because State machines are simple, they do not have to be greater than 2000 lines of code (and complexity).

Features

Using it

class User < ActiveRecord::Base
  include MinistryOfState
  ministry_of_state('status') do
    add_initial_state 'pending'
    add_state :active
    add_state :pending_payment

    add_event(:activate) do
      transitions(:from => :pending, :to => :active)
    end
  end
end

Installation

Add this line to your application’s Gemfile:

gem 'ministry_of_state'

And then execute:

$ bundle

Or install it yourself as:

$ gem ministry_of_state

Contributing to ministry_of_state

Copyright © 2011 Hemant, Neeraj and Vishnu. See LICENSE.txt for further details.