Sha256: 259a4e5d2d6b27f21c04fad02a628901312ada4fcc8f099895d9438085b55558

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

module ActiveRecord::Turntable
  module ActiveRecordExt
    module AbstractAdapter
      extend ActiveSupport::Concern

      included do
        protected

        # @note override for logging current shard name
        def log(sql, name = "SQL", binds = [])
          @instrumenter.instrument(
                                   "sql.active_record",
                                   :sql           => sql,
                                   :name          => name,
                                   :connection_id => object_id,
                                   :binds         => binds,
                                   :turntable_shard_name => turntable_shard_name) { yield }
        rescue Exception => e
          message = "#{e.class.name}: #{e.message}: #{sql} : #{turntable_shard_name}"
          @logger.error message if @logger
          exception = translate_exception(e, message)
          exception.set_backtrace e.backtrace
          raise exception
        end
      end

      def turntable_shard_name=(name)
        @turntable_shard_name = name.to_s
      end

      def turntable_shard_name
        @turntable_shard_name
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord-turntable-2.3.3 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.3.2 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.3.1 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.3.0 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.2.2 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.2.1 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.2.0 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.1.1 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.1.0 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.1.0.rc2 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.1.0.rc1 lib/active_record/turntable/active_record_ext/abstract_adapter.rb
activerecord-turntable-2.1.0.beta2 lib/active_record/turntable/active_record_ext/abstract_adapter.rb