You are working at a coffee roastery. Create a rails app that tracks coffees.
Each individual coffee
has a name
and roastedness (roast
), and is associtaed with an origin
(farm where it comes from).
A coffee farm (origin
) has a location
, phone
number and is associated with many coffees.
Migrate your app to track roastedness in a separate table. Use the seed.rb
file to put the 7 kinds of roast into the DB.
Each coffee will have a roast.
A roast will have many coffees.
Using your models will look something like this:
# get all coffees that are dark roast
Roast.find_by(name: "Italian").coffees
Change your db model to include an order for a coffee. Change your coffee table to track price per pound. Add an order
model. A coffee order has a weight
. It is associated with a coffee.
For the routes /orders
and /orders/:id
include the total price of each order. (weight * price per pound)
Create a /report
route that will display sales data.
In order to have data to display you should add more coffees and orders into your database from a seed file.
/report
should display the total sales for that day.
Change /report
to also display sales by coffee.
Change /report
to also display sales by origin.