Sha256: d22c38c4dc45e060e59dfb492c8db6073853d083d493f17c77cc255b9b767512

Contents?: true

Size: 709 Bytes

Versions: 9

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

module FreshConnection
  module Extend
    module BaseAdapter
      def self.prepended(base)
        base.send :attr_writer, :model_class
      end

      def log(*args)
        args[1] = "[#{__replica_spec_name}] #{args[1]}" if __replica_spec_name
        super
      end

      def select_all(*args)
        __change_connection { super }
      end

      def select_value(*args)
        __change_connection { super }
      end

      private

      def __replica_spec_name
        return nil if !defined?(@model_class) || !@model_class
        return nil unless FreshConnection::AccessControl.replica_access?
        @model_class.replica_spec_name
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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