Module: ActiveRecord::ConnectionHandling

Defined in:
lib/active_record/connection_adapters/spanner_adapter.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#spanner_connection(config) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/active_record/connection_adapters/spanner_adapter.rb', line 33

def spanner_connection config
  connection = ActiveRecordSpannerAdapter::Connection.new config
  connection.connect!
  ConnectionAdapters::SpannerAdapter.new connection, logger, nil, config
rescue Google::Cloud::Error => error
  if error.instance_of? Google::Cloud::NotFoundError
    raise ActiveRecord::NoDatabaseError
  end
  raise error
end