Iteration 2: Creating a Smarter Cart
Explore how to improve a shopping cart by implementing a method that checks existing items and updates quantities instead of duplicating products. Understand how to handle errors and enhance cart functionality using Rails methods like find_by and Agile iterative development.
We'll cover the following...
We'll cover the following...
Introducing some useful methods for cart
Now we need a smart add_product() method in our Cart that checks if our list of items already includes the product we’re adding. If it does, it bumps the quantity, and if it ...