class ActiveRecord::Base
see activerecord/lib/active_record/connection_adaptors/abstract/connection_specification.rb
Public Class Methods
clear_reloadable_connections!()
click to toggle source
monkey patch to fix threading problems, see: dev.rubyonrails.org/ticket/7579
# File lib/patches.rb, line 34 def self.clear_reloadable_connections! if @@allow_concurrency # Hash keyed by thread_id in @@active_connections. Hash of hashes. @@active_connections.each do |thread_id, conns| conns.each do |name, conn| if conn.requires_reloading? conn.disconnect! @@active_connections[thread_id].delete(name) end end end else # Just one level hash, no concurrency. @@active_connections.each do |name, conn| if conn.requires_reloading? conn.disconnect! @@active_connections.delete(name) end end end end
spawn_reconnect(klass=self)
click to toggle source
# File lib/patches.rb, line 6 def self.spawn_reconnect(klass=self) ActiveRecord::Base.connection.reconnect! end