Class: Dbviewer::Query::NotificationSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/dbviewer/query/notification_subscriber.rb

Overview

Handles ActiveSupport::Notifications subscription for SQL query monitoring Only active in development environment to capture and log SQL queries

Class Method Summary collapse

Class Method Details

.subscribeObject

Subscribe to SQL notifications if in development environment



10
11
12
13
14
15
16
# File 'lib/dbviewer/query/notification_subscriber.rb', line 10

def subscribe
  return unless Rails.env.development?

  ActiveSupport::Notifications.subscribe("sql.active_record") do |*args|
    process_notification(*args)
  end
end