Module: ActiveRecordProxyAdapters::Contextualizer
- Included in:
- Middleware, PrimaryReplicaProxy
- Defined in:
- lib/active_record_proxy_adapters/contextualizer.rb
Overview
A mixin for managing the context of current database connections.
Class Method Summary collapse
-
.current_context ⇒ ActiveRecordProxyAdapters::Context
Retrieves the context for the current thread.
-
.current_context=(context) ⇒ Object
Sets the context for the current thread.
Class Method Details
.current_context ⇒ ActiveRecordProxyAdapters::Context
Retrieves the context for the current thread.
10 11 12 |
# File 'lib/active_record_proxy_adapters/contextualizer.rb', line 10 def current_context Thread.current.thread_variable_get(:arpa_context) end |
.current_context=(context) ⇒ Object
Sets the context for the current thread.
16 17 18 |
# File 'lib/active_record_proxy_adapters/contextualizer.rb', line 16 def current_context=(context) Thread.current.thread_variable_set(:arpa_context, context) end |