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
This commit is contained in:
Thomas Walpole 2015-12-01 15:13:06 -08:00
parent 37238054df
commit 03a943ea84
1 changed files with 0 additions and 17 deletions

View File

@ -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