Destroy Products
Implement the DELETE function for the Product model in the application.
We'll cover the following...
Our last stop for the product endpoints will be the destroy
action. The strategy here
will be similar to the create
and update
actions in that we’ll get the
logged user with a JWT token, fetch the product from the
user.products
association, and finally destroy it, returning a 204
code.
Define the destroy
action
The implementation of the destroy
action is quite straightforward. We will add the following code to ...