Recall & Review
beginner
What is the main purpose of routing in Rails?
Routing connects a URL from the browser to a specific action in a controller, telling the app what code to run.
Click to reveal answer
beginner
In Rails, what does a route map a URL to?
A route maps a URL to a controller action, which is a method that handles the request and prepares a response.
Click to reveal answer
beginner
Why do we need routing instead of just using URLs directly?
Routing lets the app decide what to do with each URL, so URLs can be simple and meaningful while the app runs the right code behind the scenes.
Click to reveal answer
beginner
How does routing improve user experience in a web app?
Routing lets users use friendly URLs that make sense, while the app handles complex logic invisibly, making navigation smooth and clear.
Click to reveal answer
beginner
What happens if a URL does not match any route in Rails?
Rails shows a 404 error page because it doesn’t know which action to run for that URL.
Click to reveal answer
What does a Rails route connect a URL to?
✗ Incorrect
In Rails, routes connect URLs to controller actions that handle the request.
Why is routing important in a Rails app?
✗ Incorrect
Routing tells the app which controller action to run for each URL.
What happens if a URL does not match any route in Rails?
✗ Incorrect
Rails returns a 404 error when no route matches the URL.
Which file in a Rails app usually defines routes?
✗ Incorrect
Routes are defined in the config/routes.rb file.
Routing helps keep URLs:
✗ Incorrect
Routing allows URLs to be user-friendly while the app handles the logic.
Explain in your own words why routing maps URLs to actions in a Rails app.
Think about how the app knows what to do when you type a web address.
You got /3 concepts.
Describe what happens when a user visits a URL in a Rails application.
Follow the path from the browser to the app’s code.
You got /3 concepts.