Modern ActiveRecord state machine plugin
= ministry_of_state
Because State machines are simple, they do not have to be greater than 2000 lines of code (and complexity).
{}[https://travis-ci.org/code-mancers/ministry_of_state]
{}[https://codeclimate.com/repos/51d2f06213d6373729049ad3/feed]
= Features
save
.= 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
Copyright © 2011 Hemant, Neeraj and Vishnu. See LICENSE.txt for
further details.