Module: ActiveRecordQueryCounter::ConnectionAdapterExtension

Defined in:
lib/active_record_query_counter/connection_adapter_extension.rb

Overview

Module to prepend to the connection adapter to inject the counting behavior.

Defined Under Namespace

Modules: ExecQuery, InternalExecQuery

Class Method Summary collapse

Class Method Details

.inject(connection_class) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/active_record_query_counter/connection_adapter_extension.rb', line 7

def inject(connection_class)
  # Rails 7.1+ uses internal_exec_query instead of exec_query.
  mod = (connection_class.instance_methods.include?(:internal_exec_query) ? InternalExecQuery : ExecQuery)
  unless connection_class.include?(mod)
    connection_class.prepend(mod)
  end
end