Sha256: 2ef846207cb59f1e99cfec4e43dd7ba2f4cffb3accae99116bf31bfcd53abfb9

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 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.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)
      App.exception = exception
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
code_buddy-0.0.6 lib/code_buddy/rails3/railtie.rb
code_buddy-0.0.5 lib/code_buddy/rails3/railtie.rb