Class: ConsoleKit::Connections::SqlConnectionHandler
- Inherits:
-
BaseConnectionHandler
- Object
- BaseConnectionHandler
- ConsoleKit::Connections::SqlConnectionHandler
- Extended by:
- Forwardable
- Defined in:
- lib/console_kit/connections/sql_connection_handler.rb
Overview
Handles SQL connections
Instance Attribute Summary
Attributes inherited from BaseConnectionHandler
Instance Method Summary collapse
Methods inherited from BaseConnectionHandler
Constructor Details
This class inherits a constructor from ConsoleKit::Connections::BaseConnectionHandler
Instance Method Details
#available? ⇒ Boolean
21 |
# File 'lib/console_kit/connections/sql_connection_handler.rb', line 21 def available? = defined?(ApplicationRecord) |
#connect ⇒ Object
14 15 16 17 18 19 |
# File 'lib/console_kit/connections/sql_connection_handler.rb', line 14 def connect return if tenant_shard.blank? Output.print_info("Establishing SQL connection to shard: #{tenant_shard}") ApplicationRecord.establish_connection(tenant_shard.to_sym) end |