Sha256: 4bd85a61d5a89c10536d76eb325eed8c1446fe1d74a7ed3798df7d216e525679

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

module Rambulance
  class Railtie < Rails::Railtie
    initializer 'rambulance', after: :prepend_helpers_path do |app|
      ActiveSupport.on_load(:action_controller) do
        require "rambulance/exceptions_app"
      end

      app.config.exceptions_app =
        if app.config.respond_to?(:autoloader) && app.config.autoloader == :classic
          ->(env) {
            begin
              ActiveSupport::Dependencies.load_missing_constant(Object, :ExceptionsApp)
              ::ExceptionsApp.call(env)
            rescue NameError
              require "rambulance/exceptions_app" if !defined?(::Rambulance::ExceptionsApp)
              ::Rambulance::ExceptionsApp.call(env)
            end
          }
        else
          ->(env) {
            begin
              ::ExceptionsApp.call(env)
            rescue NameError
              require "rambulance/exceptions_app" if !defined?(::Rambulance::ExceptionsApp)
              ::Rambulance::ExceptionsApp.call(env)
            end
          }
        end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rambulance-3.3.0 lib/rambulance/railtie.rb
rambulance-3.2.0 lib/rambulance/railtie.rb
rambulance-3.1.0 lib/rambulance/railtie.rb
rambulance-3.0.0 lib/rambulance/railtie.rb
rambulance-2.3.0 lib/rambulance/railtie.rb
rambulance-2.2.0 lib/rambulance/railtie.rb
rambulance-2.0.0 lib/rambulance/railtie.rb
rambulance-1.1.1 lib/rambulance/railtie.rb
rambulance-1.1.0 lib/rambulance/railtie.rb
rambulance-1.0.3 lib/rambulance/railtie.rb