module Skr::Concerns::StateMachine::InstanceMethods

Public Instance Methods

fire_state_machine_event_on_save() click to toggle source
# File lib/skr/concerns/state_machine.rb, line 45
def fire_state_machine_event_on_save
    return unless state_event.present?
    event_name = state_event.to_sym
    if valid_state_events.include?( event_name )
        self.send( :aasm_fire_event, event_name,  {:persist=>false} )
    else
        errors.add(:state_event, "is not valid")
        false
    end
end
valid_state_events() click to toggle source

@return [Array of symbols] the available state_transistions

# File lib/skr/concerns/state_machine.rb, line 57
def valid_state_events
    aasm.events
end