Sha256: 6011c71a72600d4ce659b81c39dce56f08c19e0fdca1c4ca7e17b119f95cd0e9

Contents?: true

Size: 1.74 KB

Versions: 19

Compression:

Stored size: 1.74 KB

Contents

require 'airbrake'
require 'airbrake/rails/controller_methods'
require 'airbrake/rails/action_controller_catcher'
require 'airbrake/rails/error_lookup'
require 'airbrake/rails/javascript_notifier'

module Airbrake
  module Rails
    def self.initialize
      if defined?(ActionController::Base)
        ActionController::Base.send(:include, Airbrake::Rails::ActionControllerCatcher)
        ActionController::Base.send(:include, Airbrake::Rails::ErrorLookup)
        ActionController::Base.send(:include, Airbrake::Rails::ControllerMethods)
        ActionController::Base.send(:include, Airbrake::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',
                                                      Airbrake::Rack
        ::Rails.configuration.middleware.insert_after 'Rack::Lock',
                                                      Airbrake::UserInformer
      end

      Airbrake.configure(true) do |config|
        config.logger           = rails_logger
        config.environment_name = defined?(::Rails.env) && ::Rails.env || defined?(RAILS_ENV) && RAILS_ENV
        config.project_root     = defined?(::Rails.root) && ::Rails.root || defined?(RAILS_ROOT) && RAILS_ROOT
        config.framework        = defined?(::Rails.version) && "Rails: #{::Rails.version}" || defined?(::Rails::VERSION::STRING) && "Rails: #{::Rails::VERSION::STRING}"
      end
    end
  end
end

Airbrake::Rails.initialize

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
airbrake-3.2.1 lib/airbrake/rails.rb
airbrake-3.1.17 lib/airbrake/rails.rb
airbrake-3.1.16 lib/airbrake/rails.rb
airbrake-3.1.15 lib/airbrake/rails.rb
airbrake-3.1.14 lib/airbrake/rails.rb
airbrake-3.1.13 lib/airbrake/rails.rb
airbrake-3.1.12 lib/airbrake/rails.rb
airbrake-3.1.11 lib/airbrake/rails.rb
airbrake-3.1.10 lib/airbrake/rails.rb
airbrake-3.1.9 lib/airbrake/rails.rb
airbrake-3.1.8 lib/airbrake/rails.rb
airbrake-3.1.7 lib/airbrake/rails.rb
airbrake-3.1.6 lib/airbrake/rails.rb
airbrake-3.1.5 lib/airbrake/rails.rb
airbrake-3.1.4 lib/airbrake/rails.rb
airbrake-3.1.3 lib/airbrake/rails.rb
airbrake-3.1.2 lib/airbrake/rails.rb
airbrake-3.1.1 lib/airbrake/rails.rb
airbrake-3.1.0 lib/airbrake/rails.rb