Sha256: ef0be3f0b6146537ff988a4f771420fcccf325bc84d7869e67824d43d6cad241
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
# frozen_string_literal: true module FreshConnection module Extend module PgAdapter def select_all(*args) change_connection { super } end def select_rows(*args) change_connection { super } end def select_values(*args) change_connection { super } end def select_value(*args) change_connection { super } end private def change_connection return yield unless FreshConnection::AccessControl.replica_access? master_connection = @connection master_statements = @statements begin replica_connection = @model_class.replica_connection @connection = replica_connection.raw_connection @statements = replica_connection.instance_variable_get(:@statements) yield ensure @connection = master_connection @statements = master_statements end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fresh_connection-3.0.0.rc1 | lib/fresh_connection/extend/adapters/pg_adapter.rb |