Module: CloudSQLRubyConnector::Rails
- Defined in:
- lib/cloud_sql_ruby_connector/rails.rb
Overview
Rails integration for Cloud SQL Connector
Defined Under Namespace
Classes: CloudSQLPostgreSQLAdapter
Class Attribute Summary collapse
-
.connector ⇒ Object
readonly
Returns the value of attribute connector.
Class Method Summary collapse
-
.setup!(instance:, ip_type: IpAddressTypes::PUBLIC, auth_type: AuthTypes::PASSWORD, credentials: nil) ⇒ Object
Set up the Cloud SQL connector for Rails.
-
.shutdown! ⇒ Object
Close the connector and clean up resources.
Class Attribute Details
.connector ⇒ Object (readonly)
Returns the value of attribute connector.
42 43 44 |
# File 'lib/cloud_sql_ruby_connector/rails.rb', line 42 def connector @connector end |
Class Method Details
.setup!(instance:, ip_type: IpAddressTypes::PUBLIC, auth_type: AuthTypes::PASSWORD, credentials: nil) ⇒ Object
Set up the Cloud SQL connector for Rails
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cloud_sql_ruby_connector/rails.rb', line 50 def setup!(instance:, ip_type: IpAddressTypes::PUBLIC, auth_type: AuthTypes::PASSWORD, credentials: nil) @connector = PostgreSQL::Connector.new( instance, ip_type: ip_type, auth_type: auth_type, credentials: credentials ) register_adapter! register_shutdown_hook! end |
.shutdown! ⇒ Object
Close the connector and clean up resources
62 63 64 65 |
# File 'lib/cloud_sql_ruby_connector/rails.rb', line 62 def shutdown! @connector&.close @connector = nil end |