- Return a string from a route.
- Use that string and replace the inner HTML of a div.
Included in the lab is a simple Order/Invoice/Customer application. We're going to use what we've learned so far to add API endpoints and use AJAX to bring data to the page.
- Add a product
description
and aninventory
count to theProduct
model. - Create an index page for all products that displays name and a truncated description, but not inventory.
- Create the new product page so you can add new products, otherwise the rest of this might be kind of underwhelming!
- Add a route and action that gets just a product description as a plain string.
- Add another route and action that checks if inventory is available.
This route should return just
"true"
or"false"
as strings. - Add a "More Info" button to each product that, when clicked, fetches the description and the inventory and displays the result. If there is inventory available, display "Available" and if there isn't, display "Sold Out".
- Make sure tests pass!
Note: You will need to have Firefox installed for the feature specs, which use the selenium-webdriver gem to test pages with JavaScript requirements.