class AASM::Base

Public Instance Methods

has_history(enabled = true) click to toggle source
# File lib/aasm_history/aasm_ext/base.rb, line 3
def has_history enabled = true
  @options[:history_enabled] = enabled
  if enabled
    case AasmHistory::PersistanceDeterminator.determine(@klass)
      when :active_record
        configure :history_class, 'StateHistory'
        configure :creator_class, 'AasmHistory::Persistance::ActiveRecordCreator'
        @klass.send :prepend, AasmHistory::Persistance::ActiveRecord
      else
        raise AasmHistory::UnknownPersistanceLayer
    end
  end
end
history_enabled?() click to toggle source
# File lib/aasm_history/aasm_ext/base.rb, line 17
def history_enabled?
  @options[:history_enabled]
end