Recall & Review
beginner
What is the main role of a controller in Rails?
A controller receives user requests, processes them, and decides what response to send back, often by interacting with models and views.
Click to reveal answer
beginner
Why do controllers handle requests instead of models or views?
Controllers act as the middleman to keep models focused on data and views on display, making the app organized and easier to maintain.
Click to reveal answer
intermediate
How does a controller know what to do with a request?
It uses routing rules to match the request URL and HTTP method to a specific controller action that contains the logic to handle it.
Click to reveal answer
intermediate
What happens inside a controller action when handling a request?
The controller action can fetch or update data via models, then choose a view to render or redirect to another action.
Click to reveal answer
beginner
How do controllers help keep a Rails app organized?
By separating request handling from data and display, controllers keep code clear and responsibilities divided, making it easier to update and debug.
Click to reveal answer
What part of a Rails app handles incoming web requests?
✗ Incorrect
Controllers receive and handle web requests in Rails.
Which component should NOT handle user requests directly in Rails?
✗ Incorrect
Models handle data, not requests.
How does Rails know which controller action to call for a request?
✗ Incorrect
Routing matches requests to controller actions.
What does a controller usually do after processing a request?
✗ Incorrect
Controllers respond by rendering views or redirecting.
Why is it good to keep request handling in controllers?
✗ Incorrect
Controllers separate concerns for better organization.
Explain why controllers handle requests in a Rails application.
Think about how Rails keeps code organized by dividing roles.
You got /4 concepts.
Describe the flow of a web request through a Rails controller.
Follow the path from URL to response.
You got /5 concepts.