lib/rambulance/railtie.rb in rambulance-0.3.0 vs lib/rambulance/railtie.rb in rambulance-0.3.1

- old
+ new

@@ -1,26 +1,21 @@ module Rambulance class Railtie < Rails::Railtie - initializer "action_controller" do |app| + initializer 'rambulance' 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 + app.config.exceptions_app = + begin + ActiveSupport::Dependencies.load_missing_constant(Object, :ExceptionsApp) + ->(env){ ::ExceptionsApp.call(env) } + rescue NameError + ::Rambulance::ExceptionsApp + 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 + Rails.application.routes.append do + mount app.config.exceptions_app, at: '/rambulance' + end if Rails.env.development? end end end end