Sending messages to the user
Rails has a structure called flash
flash is a Hash that you can you can store stuff in as you process a request
Contents of the flash are available to the next request and then automatically deleted
Store error and debug messages in the flash to help users understand what’s happening
flash is stored in the user’s session to make it available between requests
Add a message to the flash
Verify it works
Emptying your cart
Emptying your cart (cont.)
Run your tests often
What we covered
Adding/Removing a column to an existing table with a default value
Migrating existing table data into new format
Providing flash notices to customer
Using the logger to log events
Deleted a record
Adjusted the way the cart is viewed, using CSS
Create a migration that stores the product price in the line item table. Modify add_product method to capture the price.
Add unit tests which add unique products and duplicate products.
Use the flash functionality to show helpful messages
Add the ability to delete individual line items from the cart. Bonus points to decrease quantity by 1.
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.