Sha256: ad9c2fcf490119be05fc1724ac348c297ff478b3ad50e99fc85927334fa5b6d5

Contents?: true

Size: 556 Bytes

Versions: 11

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true
require 'fresh_connection/extend/adapters/base_adapter'

module FreshConnection
  module Extend
    module M2Adapter
      private

      def __change_connection
        return yield unless FreshConnection::AccessControl.replica_access?

        master_connection = @connection
        begin
          replica_connection = @model_class.replica_connection
          @connection = replica_connection.raw_connection
          yield
        ensure
          @connection = master_connection
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fresh_connection-3.1.3 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.1.2 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.1.1 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.1.1.rc1 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.1.0 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.3 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.2 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.2.rc1 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.1 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.1.rc2 lib/fresh_connection/extend/adapters/m2_adapter.rb
fresh_connection-3.0.1.rc1 lib/fresh_connection/extend/adapters/m2_adapter.rb