Administrate::Field::StateMachine
A plugin to handle state machine attributes in Administrate.
IMPORTANT NOTICE
This gem relies on the original resource being passed to the field. This functionality is not yet merged in Administrate (a PR has been in review for a while), so you will have to fork and patch it yourself.
Usage
Add it to your Gemfile
:
gem 'administrate-field-state_machine', '~> 0.1.2'
Run:
$ bundle install
Add to your FooDashboard
:
ATTRIBUTE_TYPES = {
bar: Field::StateMachine
}.freeze
Add to your FooController
:
def permitted_attributes
super + [:state_event]
end
state_event
is used by the state machine gem to implicitly trigger the event.
About
Administrate::Field::StateMachine is maintained by z.productions.