academia.sh
/
Ruby
/
The Model–View–Controller Framework
Course
Intermediate
The Model–View–Controller Framework
Published
October 16, 2026
·
Updated
October 21, 2026
By the end of this course
Builds the request flow of a web application with model, view and controller layers
Explains how conventions, routing and filters decide which code a request reaches
Manages the data model with migrations, relationships and validations, and fixes the N+1 query problem by measuring it
Distinguishes by measurement whether a value stays only for this request, for the next request, for the session, or is persistent
Lightens the request with background jobs and caching, and applies authentication and secure defaults
01
A framework that derives template and file names from convention rather than configuration, routing that turns path patterns into a controller and an action, filters that run before the action and flash messages carried to the next request, and views compiled once and escaped on every render.
01
Convention over Configuration
The measuring axis of the course is how many requests a value stays for. The lesson runs the core, sorts thirteen observations into four stays, and shows that the template name is not written, is derived from names, and stays for this request.
02
Routing
Routing turns a path into a controller, an action and an identifier. The lesson measures that a path parameter becomes an integer, that a path that does not match the pattern is rejected, that the pattern order changes the result, and that the value stays only for this request.
03
Controllers and Filters
The controller is built anew on every request and the filter runs before the action. The lesson measures that the filter list is bound to the class, that the controller instance is bound to the request, and that the flash message is carried only to the next request.
04
Views and Templates
A template is compiled once and local values are escaped on every render. The lesson measures what escaping does, that a missing local value raises an error, that double escaping arises in a partial, and that the compiled template is persistent.
02
The model layer that maps table rows to objects, migrations that change the schema version by version, relationships between records and validations that stop a record before it is written, chained queries, the per-request query cache and the N+1 query problem.
01
Object–Relational Mapping
Measures the layer that maps a table row to an object and a table to a model; shows that a saved value is read by another client too and where the model of this core reaches its limit.
02
Migrations
Measures migrations, which change the table schema version by version; shows that an added column stays persistent, does not reach old rows, and why migrations are numbered.
03
Relationships and Validations
Measures validations that stop a record before it is written and the one-to-many relationship that links records; shows that a validation error stays only in this request and differs from a notice message.
04
The Query Interface and the N+1 Problem
Measures how many queries go to the database: the query cache stays in this request, the N+1 problem and its fix with eager loading, and the way the cache stores an empty result too.
03
Identity carried in the session and per-action authorization checks, background jobs moved out of the request, fragment caching and stale content, testing with isolated applications, and the security protections the framework turns on by default.
01
Authentication and Authorization
Measures how many requests a signed-in user's identity stays for, and why the authorization decision is recomputed on every request.
02
Background Jobs
Measures how many requests the record of a queued job stays for, what happens when the worker drains it, and why the result of the job is not in the same stay.
03
Caching
Measures a fragment being produced once and served to later requests, how it differs from the query cache, and how content becomes stale when the key does not change.
04
Testing
Measures reading a controller's instance variable from outside, the difference between a unit test and a feature test, and the effect on isolation of each test building its own application.
05
Security Defaults
Measures why the anti-forgery token is kept in the session, default escaping in the template and an allow list against mass assignment, and closes the course with a table of the stays of thirteen lessons.
Final exam
The Model–View–Controller Framework — Final Exam
In preparation
This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.
Start the exam
↑↓
↵
Esc
navigate · open · close