MVC in One Picture

One request, four stops

Every request into dogpark takes the same trip, in the same order:

  1. Browser sends GET /walkers to the dev server.
  2. config/routes.rb matches the URL to a controller action β€” walkers#index.
  3. Controller action runs Ruby code, usually asking a model to fetch rows from the database.
  4. View takes whatever the controller loaded and renders it into HTML.
  5. That HTML travels back to the browser as the response.

That's MVC: Model talks to the database, View renders HTML, Controller sits in the middle and coordinates the two. Every folder from the tour maps onto one letter: app/models is M, app/views is V, app/controllers is C. config/routes.rb isn't a letter of MVC β€” it's the map that decides which controller action even runs.