Chapters 14 & 15 - Web Apps
Exercise 2: ERB templates
Below is a Sinatra app meant to show items in an HTML “unordered list” (the
<ul> element). There are two routes.
/meats route should render HTML like this, showing a list of meats:
/fruits route should render nearly-identical HTML, but with a list of fruits.
Both routes store arrays in the
@items instance variable. And both routes rely on the below ERB code, which is stored in the
list.erb file within the
views subfolder, to render the list.