Other Pages


The Request Cycle

How does typing in a URL result in a web page being rendered? Here's a rough overview.

  1. The user types in a URL, hoping for a cool website.
  2. After the DNS gets resolved (a topic for another day), the request hits a web server, which asks Rails what it's got.
  3. Rails goes to the routes file first, which takes the URL and calls a corresponding controller action.
  4. The controller goes and gets whatever stuff it needs from the database using the relevant model.
  5. With the data the controller got from the model, it uses the view to make some HTML.
  6. Rails packages up the response and gives it to the web server.
  7. The web server delivers the response to the browser to display a cool website to the user.