<%
fillings = ["Carnitas", "Al Pastor", "Steak", "Fish", "Ground Beef"]
%>
<h1>I love tacos!</h1>
<p>There are so many kinds of tacos!</p>
<ul>
<% for filling in fillings %>
<li><%= filling %></li>
<% end %>
</ul>
<p>Currently, there are <%= fillings.count %> kinds of tacos.</p>
app/views/tacos/index.html.erb
<%
die1 = rand(1..6)
die2 = rand(1..6)
total = die1 + die2
%>
<h1>Roll the dice</h1>
<p>
<img src="/images/dice/<%= die1 %>.svg">
<img src="/images/dice/<%= die2 %>.svg">
</p>
<p>
The total is <%= total %>
</p>
<p>
<a href="/dice">Roll Again!</a>
</p>
app/views/dice/index.html.erb
<%
ranks = [2, 3, 4, 5, 6, 7, 8, 9, 10, "jack", "queen", "king", "ace"]
suits = ["clubs", "diamonds", "hearts", "spades"]
deck = []
for rank in ranks
for suit in suits
deck << "#{rank}_of_#{suit}"
end
end
shuffled_deck = deck.shuffle
hand = shuffled_deck[0,5]
%>
<h1>Welcome to the ENTR-451 Casino!</h1>
<p>
<% for card in hand %>
<img src="/images/cards/<%= card %>.svg">
<% end %>
</p>
<p>
<a href="/cards">Deal Again!</a>
</p>
app/views/cards/index.html.erb
<%
companies = Company.all
%>
<h1>Companies</h1>
<ul>
<% for company in companies %>
<li><%= company["name"] %></li>
<% end %>
</ul>
app/views/companies/index.html.erb
<%
contacts = Contact.all
%>
<h1>Contacts</h1>
<ul>
<% for contact in contacts %>
<% company = Company.find_by({ "id" => contact["company_id"] }) %>
<li>
<%= contact["first_name"] %> <%= contact["last_name"] %> @ <%= company["name"] %>
</li>
<% end %>
</ul>