Sha256: e3854d88921eccbf91a24f33a7b20de217ad76b946685503006b1cbe52327538

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

require 'airbrake'
require 'rails'

require 'airbrake/rails/middleware'

module Airbrake
  class Railtie < ::Rails::Railtie
    rake_tasks do
      require 'airbrake/rake_handler'
      require 'airbrake/rails3_tasks'
    end

    initializer "airbrake.middleware" do |app|

      middleware = if defined?(ActionDispatch::DebugExceptions)
        # Rails >= 3.2.0
        "ActionDispatch::DebugExceptions"
      else
        # Rails < 3.2.0
        "ActionDispatch::ShowExceptions"
      end

      app.config.middleware.insert_after middleware,
        "Airbrake::Rails::Middleware"

      app.config.middleware.insert 0, "Airbrake::UserInformer"
    end

    config.after_initialize do
      Airbrake.configure(true) do |config|
        config.logger           ||= config.async? ? ::Logger.new(STDERR) : ::Rails.logger
        config.environment_name ||= ::Rails.env
        config.project_root     ||= ::Rails.root
        config.framework        = "Rails: #{::Rails::VERSION::STRING}"
      end

      ActiveSupport.on_load(:action_controller) do
        # Lazily load action_controller methods
        #
        require 'airbrake/rails/controller_methods'

        include Airbrake::Rails::ControllerMethods
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
airbrake-4.3.8 lib/airbrake/railtie.rb
airbrake-4.3.7 lib/airbrake/railtie.rb
airbrake-4.3.6 lib/airbrake/railtie.rb
airbrake-4.3.5 lib/airbrake/railtie.rb
airbrake-4.3.4 lib/airbrake/railtie.rb
airbrake-4.3.3 lib/airbrake/railtie.rb
airbrake-4.3.2 lib/airbrake/railtie.rb
airbrake-4.3.1 lib/airbrake/railtie.rb
airbrake-4.3.0 lib/airbrake/railtie.rb
airbrake-4.2.1 lib/airbrake/railtie.rb
airbrake-4.2.0 lib/airbrake/railtie.rb
airbrake-4.1.0 lib/airbrake/railtie.rb
airbrake-4.0.0 lib/airbrake/railtie.rb
airbrake-3.2.0 lib/airbrake/railtie.rb