Module: SmsOnRails::LockableRecord

Defined in:
lib/sms_on_rails/activerecord_extensions/lockable_record.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: AlreadyProcessed, UnableToLockRecord

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sms_on_rails/activerecord_extensions/lockable_record.rb', line 8

def self.extended(base)
  base.class_inheritable_hash :locrec_options

  base.locrec_options = {
    :log_lock_warnings => true,
    :columns => {
      :status        => 'status',
      :processed_on  => 'processed_on',
      :notes         => 'notes',
      :retry_count   => 'retry_count',
      :sub_status    => 'sub_status'
    },

    :status => {
      :not_processed => 'NOT_PROCESSED',
      :processed     => 'PROCESSED',
      :processing    => 'PROCESSING',
      :failed        => 'FAILED',
      :cancelled     => 'CANCELLED'
    }
  }

  base.send :include, InstanceMethods
  base.send :extend,  ClassMethods
end