Iteration E3: Finishing the Cart

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.

David says:
David says:
Battle of the Routes: product_path vs. product_url

It can seem hard in the beginning to know when to use product_path and when to use product_url when you want to link or redirect to a given route. In reality, it’s simple.

When you use product_url, you’ll get the full enchilada with protocol and domain name, like That’s the thing to use when you’re doing redirect_to, because the HTTP spec requires a ...

Get Agile Web Development with Rails 5, 1st Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.