Skip to content
Permalink
Browse files

Update README.md

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 with 0 additions and 17 deletions.
  1. +0 −17 README.md
@@ -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](https://github.com/DatabaseCleaner/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:

```ruby
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
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.
You can’t perform that action at this time.