Module: ErrornotNotifier::Rails

Defined in:
lib/errornot_notifier/rails.rb,
lib/errornot_notifier/rails/error_lookup.rb,
lib/errornot_notifier/rails/controller_methods.rb,
lib/errornot_notifier/rails/javascript_notifier.rb,
lib/errornot_notifier/rails/action_controller_catcher.rb

Defined Under Namespace

Modules: ActionControllerCatcher, ControllerMethods, ErrorLookup, JavascriptNotifier

Class Method Summary collapse

Class Method Details

.initializeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/errornot_notifier/rails.rb', line 9

def self.initialize
  if defined?(ActionController::Base)
    ActionController::Base.send(:include, ErrornotNotifier::Rails::ActionControllerCatcher)
    ActionController::Base.send(:include, ErrornotNotifier::Rails::ErrorLookup)
    ActionController::Base.send(:include, ErrornotNotifier::Rails::ControllerMethods)
    ActionController::Base.send(:include, ErrornotNotifier::Rails::JavascriptNotifier)
  end

  rails_logger = if defined?(::Rails.logger)
                   ::Rails.logger
                 elsif defined?(RAILS_DEFAULT_LOGGER)
                   RAILS_DEFAULT_LOGGER
                 end

  if defined?(::Rails.configuration) && ::Rails.configuration.respond_to?(:middleware)
    ::Rails.configuration.middleware.insert_after 'ActionController::Failsafe',
      ErrornotNotifier::Rack
  end

  ErrornotNotifier.configure(true) do |config|
    config.logger = rails_logger
    config.environment_name = RAILS_ENV  if defined?(RAILS_ENV)
    config.project_root     = RAILS_ROOT if defined?(RAILS_ROOT)
    config.framework        = "Rails: #{::Rails::VERSION::STRING}" if defined?(::Rails::VERSION)
  end
end