Skip to content
Browse files
Remove the suggestion of sharing database connections between threads, it's error prone and definitely not a good idea for beginner users of Capybara
  • Loading branch information
twalpole committed Dec 1, 2015
1 parent 3723805 commit 03a943ea84a4d7ed2e57d6ad74c357ec1982a956
Showing 1 changed file with 0 additions and 17 deletions.
@@ -684,23 +684,6 @@ Cucumber handles this by using truncation instead of transactions, i.e. they
empty out the entire database after each test. You can get the same behaviour
by using a gem such as [database_cleaner](

It is also possible to force your ORM to use the same transaction for all
threads. This may have thread safety implications and could cause strange
failures, so use caution with this approach. It can be implemented in
ActiveRecord through the following monkey patch:

class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

## Asynchronous JavaScript (Ajax and friends)

When working with asynchronous JavaScript, you might come across situations

0 comments on commit 03a943e

Please sign in to comment.