Project

enum_aasm

0.0
No commit activity in last 3 years
No release in over 3 years
This gem patches AASM to use PowerEnum enums for states.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

>= 0
 Project Readme

EnumAasm

An extension to the AASM finite state machine that uses PowerEnum enumerated attributes for state transitions.

Installation

Add this line to your application's Gemfile:

gem 'enum_aasm'

And then execute:

$ bundle

Or install it yourself as:

$ gem install enum_aasm

Usage

Basically the same usage as the original AASM. The only difference is that the :column option is mandatory. Use this option to specify the name of the enumerated attribute. Note that scopes are not defined by the state machine as PowerEnum already handles this functionality.

Example

require 'enum_aasm'

class Fruit < ActiveRecord::Base
  include AASM

  has_enumerated :fruit_color

  aasm :column => :fruit_color do
    state :green, :initial => true
  end
end

License

Distributed under the MIT license. See LICENSE.txt for details.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright 2014 Arthur Shagall