Sha256: e1a5e3dfbab378752caef0231d0fa85428c990441b809d43af875b7cf51d136c

Contents?: true

Size: 385 Bytes

Versions: 26

Compression:

Stored size: 385 Bytes

Contents

module ActiveRecord
  class Base
    mattr_accessor :shared_connection
    @@shared_connection = nil

    def self.connection
      @@shared_connection || retrieve_connection
    end
  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

26 entries across 26 versions & 3 rubygems

Version Path
date_book-0.0.6 spec/support/shared_connection.rb
date_book-0.0.5 spec/support/shared_connection.rb
date_book-0.0.3 spec/support/shared_connection.rb
date_book-0.0.2 spec/support/shared_connection.rb
date_book-0.0.1 spec/support/shared_connection.rb
message_train-0.6.17 spec/support/shared_connection.rb
message_train-0.6.16 spec/support/shared_connection.rb
message_train-0.6.15 spec/support/shared_connection.rb
message_train-0.6.14 spec/support/shared_connection.rb
message_train-0.6.13 spec/support/shared_connection.rb
message_train-0.6.12 spec/support/shared_connection.rb
message_train-0.6.11 spec/support/shared_connection.rb
message_train-0.6.10 spec/support/shared_connection.rb
message_train-0.6.9 spec/support/shared_connection.rb
message_train-0.6.8 spec/support/shared_connection.rb
message_train-0.6.7 spec/support/shared_connection.rb
message_train-0.6.6 spec/support/shared_connection.rb
message_train-0.6.5 spec/support/shared_connection.rb
message_train-0.6.4 spec/support/shared_connection.rb
message_train-0.6.3 spec/support/shared_connection.rb