Sha256: e36f1ffccfd7caf1795f15fdc3a1ee1bf68aacd23ecd17cccebfe0fa6c17f10b

Contents?: true

Size: 362 Bytes

Versions: 15

Compression:

Stored size: 362 Bytes

Contents

class ActiveRecord::Base
  mattr_accessor :shared_connection
  @@shared_connection = nil
 
  def self.connection
    @@shared_connection || retrieve_connection
  end
end
 
# Forces all threads to share the same connection. This works on
# Capybara because it starts the web server in a thread.
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pah-0.0.15 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.14 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.13 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.12 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.11 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.10 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.9 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.8 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.7 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.6 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.5 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.4 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.3 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.2 lib/pah/files/spec/support/shared_connection.rb
pah-0.0.1 lib/pah/files/spec/support/shared_connection.rb