Sha256: 7ea7653e4d5bab2f6b1bea5a8d374d7737889f72e0d9a0670addcd84ebf94f14

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 Bytes

Contents

module CodeBuddy
  class Railtie < Rails::Railtie
    initializer "code_buddy.add_middleware" do |app|
      if app.config.action_dispatch.show_exceptions
        app.middleware.swap          ActionDispatch::ShowExceptions, CodeBuddy::ShowExceptions, app.config.consider_all_requests_local
        app.middleware.insert_before CodeBuddy::ShowExceptions, CodeBuddy::ShowApp
      end
    end
  end

  class ShowExceptions < ActionDispatch::ShowExceptions

    silence_warnings do
      ActionDispatch::ShowExceptions::RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates')
    end

    def rescue_action_locally(request, exception)
      CodeBuddy::App.exception = exception
      super
    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
code_buddy-0.1.2 lib/code_buddy/rails3/railtie.rb
code_buddy-0.1.1 lib/code_buddy/rails3/railtie.rb
code_buddy-0.1.0 lib/code_buddy/rails3/railtie.rb