Class: RailsLiveDashboard::Subscribers::ActionControllerSubscriber

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

Instance Method Summary collapse

Constructor Details

#initializeActionControllerSubscriber

Returns a new instance of ActionControllerSubscriber.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails_live_dashboard/subscribers/action_controller_subscriber.rb', line 4

def initialize
  ActiveSupport::Notifications.subscribe 'start_processing.action_controller' do |_event|
    RailsLiveDashboard::Context.instance.start
  end

  ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |event|
    next if event.payload[:controller].include?('RailsLiveDashboard')

    handle_event(event)
  rescue StandardError => e
    Rails.logger.error "Error on handle action controller event: #{e.message}"
  end
end