Dispatching Requests to Controllers
At its most basic, a web application accepts an incoming request from a browser, processes it, and sends a response.
The first question that springs to mind is, 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 will use when you need to and a convenient way that you will generally use whenever you can.
The comprehensive way lets you define a direct mapping of URLs to actions based on pattern matching, requirements, ...
Get Agile Web Development with Rails 6 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.