Sha256: e828f8495be9bb488ccec9a478219b435056e4e5a5e89ea9c18ab1031a90bcba
Contents?: true
Size: 659 Bytes
Versions: 2
Compression:
Stored size: 659 Bytes
Contents
# frozen_string_literal: true module FreshConnection module Extend module PgAdapter 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fresh_connection-3.0.0 | lib/fresh_connection/extend/adapters/pg_adapter.rb |
fresh_connection-3.0.0.rc2 | lib/fresh_connection/extend/adapters/pg_adapter.rb |