Sha256: 6d40cb46b5e17872b3f48d8a306a507e8ad8af8a012b0831da13761f0980d250
Contents?: true
Size: 717 Bytes
Versions: 13
Compression:
Stored size: 717 Bytes
Contents
# frozen_string_literal: true require 'active_record' require 'active_record/connection_adapters/abstract/connection_pool' require 'active_record/connection_adapters/postgresql_adapter' module TableSaw module Connection def self.with raise ArgumentError, 'requires a block' unless block_given? yield adapter.raw_connection end def self.exec(sql) TableSaw::Connection.with do |conn| conn.exec(sql) end end def self.adapter @adapter ||= begin config = TableSaw.configuration.connection conn = ::PG::Connection.new(config) ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(conn, nil, config, {}) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems