Module: RaceGuard::ActiveRecord
- Defined in:
- lib/race_guard/active_record.rb
Overview
Optional integration: mirror ActiveRecord::Base.transaction boundaries onto context (begin_transaction / end_transaction).
Require after ActiveRecord is loaded, or call ActiveRecord.install_transaction_tracking! again after require “active_record”.
Defined Under Namespace
Modules: TransactionPatch
Constant Summary collapse
- INSTALL_MUTEX =
Mutex.new
Class Method Summary collapse
Class Method Details
.install_transaction_tracking! ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/race_guard/active_record.rb', line 35 def install_transaction_tracking! return self unless defined?(::ActiveRecord::Base) INSTALL_MUTEX.synchronize do sc = ::ActiveRecord::Base.singleton_class return self if sc.ancestors.include?(TransactionPatch) sc.prepend(TransactionPatch) end self end |