Sha256: 16e10114e722ab98d601226bdd54aeecc360cb034094ce428176d8df0ae7ebc5

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

module Rambulance
  class Railtie < Rails::Railtie
    initializer "action_controller" do |app|
      require "rambulance/exceptions_app"
    end

    initializer "activesupport.dependencies" do |app|
      begin
        ActiveSupport::Dependencies.load_missing_constant(Object, :ExceptionsApp)
        app.config.exceptions_app = ->(env){ ::ExceptionsApp.call(env) }
      rescue NameError
        app.config.exceptions_app = ::Rambulance::ExceptionsApp
      end
    end

    initializer 'rambulance' do |app|
      ActiveSupport.on_load(:after_initialize) do
        if Rails.env.development?
          Rails.application.routes.append do
            mount app.config.exceptions_app, at: '/rambulance'
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rambulance-0.3.0 lib/rambulance/railtie.rb
rambulance-0.2.0 lib/rambulance/railtie.rb
rambulance-0.1.2 lib/rambulance/railtie.rb
rambulance-0.1.1 lib/rambulance/railtie.rb