0.0
No commit activity in last 3 years
No release in over 3 years
Simple implementation of state machine for Rails using enums.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3

Runtime

~> 4.1
 Project Readme

RailsMachine¶ ↑

Simple implementation of state machine for Rails greater than 4.1.

In this project we used Enums introduced in Rails 4.1.

Usage¶ ↑

class Vehicle < ActiveRecord::Base
  include RailsMachine

  rails_machine do
    state :first_state # Not explicitly sets id to 1
    state :test, id: 10
    state :another # Not explicitly sets id to 11

    transition to: :another
    transition from: :another
  end
end