Module: ActiveRecord::RuntimeRegistry

Extended by:
RuntimeRegistry
Included in:
RuntimeRegistry
Defined in:
lib/active_record/runtime_registry.rb

Overview

This is a thread locals registry for Active Record. For example:

ActiveRecord::RuntimeRegistry.sql_runtime

returns the connection handler local to the current unit of execution (either thread of fiber).

Instance Method Summary collapse

Instance Method Details

#sql_runtimeObject



12
13
14
# File 'lib/active_record/runtime_registry.rb', line 12

def sql_runtime
  ActiveSupport::IsolatedExecutionState[:active_record_sql_runtime]
end

#sql_runtime=(runtime) ⇒ Object



16
17
18
# File 'lib/active_record/runtime_registry.rb', line 16

def sql_runtime=(runtime)
  ActiveSupport::IsolatedExecutionState[:active_record_sql_runtime] = runtime
end