Class: RailsLiveDashboard::Subscribers::ActiveRecordSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_live_dashboard/subscribers/active_record_subscriber.rb

Instance Method Summary collapse

Constructor Details

#initializeActiveRecordSubscriber

Returns a new instance of ActiveRecordSubscriber.



4
5
6
7
8
9
10
11
12
# File 'lib/rails_live_dashboard/subscribers/active_record_subscriber.rb', line 4

def initialize
  ActiveSupport::Notifications.subscribe 'sql.active_record' do |event|
    next if should_skip(event)

    Recorders::QueryRecorder.new(event).execute
  rescue StandardError => e
    Rails.logger.error "ActionRecordSubscriber - Error on handle active record event: #{e.message}"
  end
end