Finishing the Cart
Explore how to finish the cart functionality in a Rails e-commerce app by adding empty cart actions, updating controller methods, and improving cart display with tables and styling. This lesson helps you handle user sessions, manage notifications, and enhance the cart’s presentation for a polished application.
We'll cover the following...
We'll cover the following...
We know by now that to implement the empty-cart function, we have to add a link to the cart and modify the destroy() method in the carts controller to clean up the session.
Start with the template and use the button_to() method in line 12, to add a button:
Modifying the controller
In the controller, let’s modify the destroy() ...