Class: Radar::Integration::Rails2

Inherits:
Object
  • Object
show all
Defined in:
lib/radar/integration/rails2.rb,
lib/radar/integration/rails2/action_controller_rescue.rb

Overview

Allows drop-in integration with Rails 2 for Radar. This monkeypatches ActionController::Base to capture errors and also enables a data extension to extract the Rails 2 request information into the exception event.

Defined Under Namespace

Modules: ActionControllerRescue

Constant Summary collapse

@@integrated_apps =
[]

Class Method Summary collapse

Class Method Details

.integrate!(app) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/radar/integration/rails2.rb', line 12

def self.integrate!(app)
  # Only monkeypatch ActionController::Base once
  ActionController::Base.send(:include, ActionControllerRescue) if @@integrated_apps.empty?

  # Only integrate each application once
  if !@@integrated_apps.include?(app)
    app.data_extensions.use :rails2
    @@integrated_apps << app
  end
end

.integrated_appsObject

Returns all the Radar applications which have been integrated with Rails 2, in the order that they were integrated. This Array is duped so that no modifications can be made to it.



26
27
28
# File 'lib/radar/integration/rails2.rb', line 26

def self.integrated_apps
  @@integrated_apps.dup
end