module Skr::Concerns::StateMachine::ClassMethods
Public Instance Methods
state_machine( options={}, &block )
click to toggle source
Mark class as a StateMachine
{github.com/aasm/aasm}
Specifically it:
* Adds the methods in {InstanceMethods} to the class * Blacklists the "state" field so it cannot be set via the API * Allows access to the "state_event" pseudo field from the API * Sets up the aasm library with the contents of &block
# File lib/skr/concerns/state_machine.rb, line 23 def state_machine( options={}, &block ) include InstanceMethods include AASM aasm( options.merge( column: 'state' ), &block ) json_attr_accessor :state_event export_methods :valid_state_events, :optional=>false blacklist_json_attributes :state whitelist_json_attributes :state_event before_save :fire_state_machine_event_on_save end