18. initialize_routing: Loads and processes the routes. Also sets the controller
paths from the controller_paths configuration item.
19. after_initialize: Calls any user-defined after_initialize callback. These callbacks
are defined in the configuration block by config.after_initialize { ... }.
20. load_application_initializers: Loads all Ruby files in RAILS_ROOT/config/
initializers and any of its subdirectories. Old framework initialization that may
previously have been contained in config/environment.rb can now properly be
broken out into separate initializers.
Now the framework is ready to receive requests.
Request Dispatch
dispatcher.rb, fcgi_handler.rb, webrick_server.rb
The Dispatcher class is the outside world??™s interface to Rails. Web servers dispatch
a request to Rails by calling Dispatcher.dispatch(cgi, session_options,
output). Rails processes the given CGI request and presents the output to the
given location (which defaults to standard output). Rails can be reset by calling
Dispatcher.reset_application! to process multiple requests.
78 | Chapter 2: ActiveSupport and RailTies
There are many ways to serve a Rails application. fcgi_handler.rb contains the
FastCGI handler (RailsFCGIHandler) that shims between a FastCGI-speaking server
(Apache, lighttpd, or even IIS) and Rails. webrick_server.rb is a server based on
WEBrick that can serve Rails.
Pages:
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126