Module: Sequel::Plugins::StateMachine

Defined in:
lib/sequel/plugins/state_machine.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: InvalidConfiguration

Class Method Summary collapse

Class Method Details

.apply(_model, _opts = {}) ⇒ Object



13
14
15
# File 'lib/sequel/plugins/state_machine.rb', line 13

def self.apply(_model, _opts={})
  nil
end

.configure(model, opts = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sequel/plugins/state_machine.rb', line 17

def self.configure(model, opts={})
  (opts = {status_column: opts}) if opts.is_a?(Symbol)
  model.instance_eval do
    # See state_machine_status_column.
    # We must defer defaulting the value in case the plugin
    # comes ahead of the state  machine (we can see a valid state machine,
    # but the attribute/name will always be :state, due to some configuration
    # order of operations).
    @sequel_state_machine_status_column = opts[:status_column] if opts[:status_column]
    @sequel_state_machine_audit_logs_association = opts[:audit_logs_association] || :audit_logs
  end
end