Guest User

Untitled

a guest
Aug 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. class ActiveRecord::Base
  2. mattr_accessor :shared_connection
  3. @@shared_connection = nil
  4.  
  5. def self.connection
  6. @@shared_connection || retrieve_connection
  7. end
  8. end
  9.  
  10. # Forces all threads to share the same connection. This works on
  11. # Capybara because it starts the web server in a thread.
  12. ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
Add Comment
Please, Sign In to add comment