Module: TestProf::ActiveRecordSharedConnection

Defined in:
lib/test_prof/recipes/active_record_shared_connection.rb

Overview

Forces ActiveRecord to use the same connection between threads

Defined Under Namespace

Modules: Connection, Ext

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connectionObject

Returns the value of attribute connection.



7
8
9
# File 'lib/test_prof/recipes/active_record_shared_connection.rb', line 7

def connection
  @connection
end

Class Method Details

.disable!Object



13
14
15
# File 'lib/test_prof/recipes/active_record_shared_connection.rb', line 13

def disable!
  self.connection = nil
end

.enable!Object



9
10
11
# File 'lib/test_prof/recipes/active_record_shared_connection.rb', line 9

def enable!
  self.connection = ActiveRecord::Base.connection
end