A Bit More on Dispatching Requests
Learn about REST requests in detail.
We'll cover the following...
Adding additional actions
Rails resources provide us with an initial set of actions, but we needn’t stop there. In Atom Feeds, we added an interface to allow people to fetch a list of who bought any given product. To do that with Rails, we use an extension to the resources call:
Press + to interact
Depot::Application.routes.draw doresources :products doget :who_bought, on: :memberendend
That syntax is straightforward. It says “We want to add a new action named who_bought
in line 3 ...