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
719 720 721 722 723 724 725 726 727 728 729 730 731 |
# File 'lib/immunio/plugins/active_record.rb', line 719 def log_with_immunio(sql, name = "SQL", binds = [], *args) # Some rails tests (in particular postresql) call :log with nil `sql`. QueryTracker.instance.call( { sql: sql, connection_id: object_id, binds: binds }, adapter_name) if sql # Log and execute the query log_without_immunio(sql, name, binds, *args) { yield } end |