module RailsStateMachine::Model::ClassMethods

Public Instance Methods

state_events(state_attribute = DEFAULT_STATE_ATTRIBUTE) click to toggle source
# File lib/rails_state_machine/model.rb, line 30
def state_events(state_attribute = DEFAULT_STATE_ATTRIBUTE)
  state_machine(state_attribute).event_names
end
state_machine(state_attribute = DEFAULT_STATE_ATTRIBUTE, &block) click to toggle source
# File lib/rails_state_machine/model.rb, line 17
def state_machine(state_attribute = DEFAULT_STATE_ATTRIBUTE, &block)
  state_machine = state_machines[state_attribute] ||= StateMachine.new(self, state_attribute)
  if block
    include(Callbacks) unless self < Callbacks
    state_machine.configure(&block)
  end
  state_machine
end
states(state_attribute = DEFAULT_STATE_ATTRIBUTE) click to toggle source
# File lib/rails_state_machine/model.rb, line 26
def states(state_attribute = DEFAULT_STATE_ATTRIBUTE)
  state_machine(state_attribute).state_names
end