Dispatching Requests to Controllers
At its most basic, a web application accepts an incoming request from a browser, processes it, and sends a response.
A question immediately springs to mind: how does the application know what to do with the incoming request? A shopping cart application will receive requests to display a catalog, add items to a cart, create an order, and so on. How does it route these requests to the appropriate code?
It turns out that Rails provides two ways to define how to route a request: a comprehensive way that you’ll use when you need to and a convenient way that you’ll generally use whenever you can.
The comprehensive way lets you define a direct mapping of URLs to actions based on pattern matching, requirements, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access