I'd like to add a microapp for errors to be processed (file I placed inside the lib folder).
module MyApp
  class Application < Rails::Application
    config.autoload_paths += %W( #{config.root}/lib )
    config.exceptions_app = FooApp.new(Rails.public_path)
  end
end
But Rails raises an unitialized constant (NameError) during it's initialization. Recently I found a similar post and tried every solution from there, but got no result. What actually I've tried:
- Name a class and a filename according to convention (even tried to simplify to a single word - class Foo, filename lib/foo.rb).
- Use config.eager_load_paths += %W( #{config.root}/lib )rather thanconfig.autoload_paths, same effect. :(
- Create an initializer file and load a class with require: require "#{Rails.root}/lib/foo"It doesn't work - seems initializers are performed after the initial Rails configuration.
- Move the file into app/misc but it doesn't help.
- Put a class inside a module with the same name, rename a class while it's still in the module - no effect.
The only working solution I found - is to require a file right inside the Rails configuration block, but... it's a freaky solution. Probably there still exists an idiomatic one?
 
    