What code runs when you request a page from a Ruby on Rails application?
Here is an annotated trace showing every method call within Rails and its dependencies. It is for an example application that loads a blog post from the database and renders a page containing the post's title.
ActionDispatch::Routing::RouteSet is the last Rack middleware to be called. It looks up what route the request refers to using
ActionDispatch::Journey::Router. Later this route will be used to call the right controller in our application.
When a Rails application starts the routes defined in
config/routes.rb are processed to make it easier to lookup which route a request should use.