class Application
Ruby on Rails 8.0.4
Since v3.0.20An Engine 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 enable_reloading, 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:
-
require "config/boot.rb"to set up load paths. -
requirerailties and engines. -
Define
Rails.applicationasclass MyApp::Application < Rails::Application. -
Run
config.before_configurationcallbacks. -
Load
config/environments/ENV.rb. -
Run
config.before_initializecallbacks. -
Run
Railtie#initializerdefined by railties, engines, and application. One by one, each engine sets up its load paths and routes, and runs itsconfig/initializers/*files. -
Custom
Railtie#initializersadded by railties, engines, and applications are executed. -
Build the middleware stack and run
to_preparecallbacks. -
Run
config.before_eager_loadandeager_load!ifeager_loadistrue. -
Run
config.after_initializecallbacks.
Inherits from
Namespace
Modules
Classes
Constants
Attributes
Methods (defined here)
- # config_for
- # console
- # credentials
- # deprecators
- # eager_load!
- # encrypted
- # ensure_generator_templates_added
- # env_config
- # generators
- # initialized?
- # initializer
- # isolate_namespace
- # key_generator
- # message_verifier
- # message_verifiers
- # name
- # rake_tasks
- # reload_routes!
- # runner
- # secret_key_base
- # server
- self. create
- self. find_root
- self. inherited
- self. instance
- self. new