- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-2)
- 3.1.0 (0)
- 3.2.1 (38)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (-2)
- 4.1.8 (35)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (-4)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (-35)
- 7.1.3.2 (3)
- 7.1.3.4 (0)
- What's this?
In Rails 3.0, a Rails::Application object was introduced which is nothing more than an Engine but with the responsibility of coordinating the whole boot process.
Initialization
Rails::Application is responsible for executing all railties and engines initializers. It also executes some bootstrap initializers (check Rails::Application::Bootstrap) and finishing initializers, after all the others are executed (check Rails::Application::Finisher).
Configuration
Besides providing the same configuration as Rails::Engine and Rails::Railtie, the application object has several specific configurations, for example “cache_classes”, “consider_all_requests_local”, “filter_parameters”, “logger” and so forth.
Check Rails::Application::Configuration to see them all.
Routes
The application object is also responsible for holding the routes and reloading routes whenever the files change in development.
Middlewares
The Application is also responsible for building the middleware stack.
Booting process
The application is also responsible for setting up and executing the booting process. From the moment you require “config/application.rb” in your app, the booting process goes like this:
1) require "config/boot.rb" to setup load paths 2) require railties and engines 3) Define Rails.application as "class MyApp::Application < Rails::Application" 4) Run config.before_configuration callbacks 5) Load config/environments/ENV.rb 6) Run config.before_initialize callbacks 7) Run Railtie#initializer defined by railties, engines and application. One by one, each engine sets up its load paths, routes and runs its config/initializers/* files. 8) Custom Railtie#initializers added by railties, engines and applications are executed 9) Build the middleware stack and run to_prepare callbacks 10) Run config.before_eager_load and eager_load! if eager_load is true 11) Run config.after_initialize callbacks