Module: Simple::SQL::ConnectionManager

Extended by:
ConnectionManager
Included in:
ConnectionManager
Defined in:
lib/simple/sql/connection_manager.rb

Defined Under Namespace

Modules: WritableClassName

Instance Method Summary collapse

Instance Method Details

#connection_class(url) ⇒ Object



21
22
23
# File 'lib/simple/sql/connection_manager.rb', line 21

def connection_class(url)
  connection_class_by_url[url] ||= create_connection_class(url)
end

#disconnect_all!Object



13
14
15
16
17
18
19
# File 'lib/simple/sql/connection_manager.rb', line 13

def disconnect_all!
  ActiveRecord::Base.connection_pool.disconnect! if ActiveRecord::Base.connected?

  connection_classes = connection_class_by_url.values
  connection_classes.select(&:connected?).map(&:connection_pool).each(&:disconnect!)
  connection_class_by_url.clear
end