Add some features to AASM. Include
- scopes.
- pass more params when trigger events.
- log state changes,
Add this line to your application's Gemfile:
gem 'aasm_plus'
And then execute:
$ bundle
Or install it yourself as:
$ gem install aasm_plus
- Edit target model.
# In model that to include AasmEnhancing
include AASM
include AasmPlus::Stateable
# Add into aasm config
before_all_events :set_related_data
after_all_transitions :log_state_change
- Run migration, it will create tables for state chains.
rails aasm_plus:install:migrations
rails db:migrate
The gem is available as open source under the terms of the MIT License.