Module: ActiveRecord::Turntable::ActiveRecordExt::AbstractAdapter::V5_2

Defined in:
lib/active_record/turntable/active_record_ext/abstract_adapter.rb

Overview

Note:

override for append current shard name

rubocop:disable Style/HashSyntax, Style/MultilineMethodCallBraceLayout

Instance Method Summary collapse

Instance Method Details

#log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/active_record/turntable/active_record_ext/abstract_adapter.rb', line 27

def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil)
  @instrumenter.instrument(
    "sql.active_record",
    sql:                  sql,
    name:                 name,
    binds:                binds,
    type_casted_binds:    type_casted_binds,
    statement_name:       statement_name,
    connection_id:        object_id,
    turntable_shard_name: turntable_shard_name) do
    begin
      @lock.synchronize do
        yield
      end
    rescue => e
      raise translate_exception_class(e, sql)
    end
  end
end