Module: ZeevexReliability::OptimisticLockRetryable

Defined in:
lib/zeevex_reliability/optimistic_lock_retryable.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/zeevex_reliability/optimistic_lock_retryable.rb', line 3

def self.included(base)
  require 'active_record'
  require 'active_record/base'
  base.class_eval do
    include InstanceMethods
  end
end

.install(*clazzes) ⇒ Object

With no args, include ‘with_optimistic_retry’ into ActiveRecord::Base. Otherwise, include it into AR::Base



15
16
17
18
19
20
21
# File 'lib/zeevex_reliability/optimistic_lock_retryable.rb', line 15

def self.install(*clazzes)
  clazzes = [ActiveRecord::Base] if (clazzes.nil? || clazzes.empty?)

  clazzes.each do |clazz|
    clazz.send :include, ZeevexReliability::OptimisticLockRetryable
  end
end