Sha256: bc8a88936bcad6126a6d235eb719210216fe998bff4b30c510c1205b0a78aa71
Contents?: true
Size: 1 KB
Versions: 23
Compression:
Stored size: 1 KB
Contents
ActiveRecord::ConnectionAdapters::ConnectionHandler.class_eval do # The only difference here is that we use klass.connection_pool_name # instead of klass.name as the pool key def retrieve_connection_pool(klass) pool = @connection_pools[klass.connection_pool_name] return pool if pool return nil if ActiveRecord::Base == klass retrieve_connection_pool klass.superclass end def remove_connection(klass) pool = @connection_pools[klass.connection_pool_name] @connection_pools.delete_if { |key, value| value == pool } pool.disconnect! if pool pool.spec.config if pool end end ActiveRecord::Base.singleton_class.class_eval do def establish_connection_with_connection_pool_name(spec = nil) case spec when ActiveRecord::Base::ConnectionSpecification connection_handler.establish_connection(connection_pool_name, spec) else establish_connection_without_connection_pool_name(spec) end end alias_method_chain :establish_connection, :connection_pool_name end
Version data entries
23 entries across 23 versions & 1 rubygems