Sha256: 4eebe6e20e40056810b81268dbf243dda53056574db7b0ce48444064f7638bf9

Contents?: true

Size: 1.62 KB

Versions: 22

Compression:

Stored size: 1.62 KB

Contents

require 'rails/railtie'
require 'rollbar'

module Rollbar
  class Railtie < ::Rails::Railtie
    rake_tasks do
      require 'rollbar/rake_tasks'
    end
    
    initializer 'rollbar.middleware.rails' do |app|
      if defined?(ActionDispatch::DebugExceptions)
        # Rails 3.2.x+
        require 'rollbar/middleware/rails/rollbar'
        require 'rollbar/middleware/rails/show_exceptions'
        
        app.config.middleware.insert_after ActionDispatch::DebugExceptions,
          Rollbar::Middleware::Rails::RollbarMiddleware
        ActionDispatch::DebugExceptions.send(:include, Rollbar::Middleware::Rails::ShowExceptions)
      elsif defined?(ActionDispatch::ShowExceptions)
        # Rails 3.0.x and 3.1.x
        require 'rollbar/middleware/rails/rollbar'
        require 'rollbar/middleware/rails/show_exceptions'
        
        app.config.middleware.insert_after ActionDispatch::ShowExceptions,
          Rollbar::Middleware::Rails::RollbarMiddleware
        ActionDispatch::ShowExceptions.send(:include, Rollbar::Middleware::Rails::ShowExceptions)
      end
    end

    config.after_initialize do
      Rollbar.preconfigure do |config|
        config.logger ||= ::Rails.logger
        config.environment ||= ::Rails.env
        config.root ||= ::Rails.root
        config.framework = "Rails: #{::Rails::VERSION::STRING}"
        config.filepath ||= ::Rails.application.class.parent_name + '.rollbar'
      end

      ActiveSupport.on_load(:action_controller) do
        # lazily load action_controller methods
        require 'rollbar/rails/controller_methods'
        include Rollbar::Rails::ControllerMethods
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rollbar-1.4.4 lib/rollbar/railtie.rb
rollbar-1.4.3 lib/rollbar/railtie.rb
rollbar-1.4.2 lib/rollbar/railtie.rb
rollbar-1.4.1 lib/rollbar/railtie.rb
rollbar-1.4.0 lib/rollbar/railtie.rb
rollbar-1.3.2 lib/rollbar/railtie.rb
rollbar-1.3.1 lib/rollbar/railtie.rb
rollbar-1.3.0 lib/rollbar/railtie.rb
rollbar-1.2.13 lib/rollbar/railtie.rb
rollbar-1.2.12 lib/rollbar/railtie.rb
rollbar-1.2.11 lib/rollbar/railtie.rb
rollbar-1.2.10 lib/rollbar/railtie.rb
rollbar-1.2.9 lib/rollbar/railtie.rb
rollbar-1.2.8 lib/rollbar/railtie.rb
rollbar-1.2.7 lib/rollbar/railtie.rb
rollbar-1.2.6 lib/rollbar/railtie.rb
rollbar-1.2.5 lib/rollbar/railtie.rb
rollbar-1.2.4 lib/rollbar/railtie.rb
rollbar-1.2.3 lib/rollbar/railtie.rb
rollbar-1.2.2 lib/rollbar/railtie.rb