Module: Immunio::QueryExecutionHooks

Extended by:
ActiveSupport::Concern
Defined in:
lib/immunio/plugins/active_record.rb

Overview

Hook into the SQL query execution methods of Rails. Since all executed queries inside Rails are logged, we hook into the ‘log` method to catch them all.

Instance Method Summary collapse

Instance Method Details

#log_with_immunio(sql, name = "SQL", binds = [], *args) ⇒ Object



672
673
674
675
676
677
678
679
# File 'lib/immunio/plugins/active_record.rb', line 672

def log_with_immunio(sql, name = "SQL", binds = [], *args)
  QueryTracker.instance.call sql: sql,
                             connection_id: object_id,
                             binds: binds

  # Log and execute the query
  log_without_immunio(sql, name, binds, *args) { yield }
end