Skip to content

Commit 99c200b

Browse files
author
Theresa
committed
Add edge cases
1 parent 9ae8bcb commit 99c200b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/views/carts/index.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
<% if cart.user === current_user %>
1010
<% if cart.exercises %>
1111
<% cart.exercises.each do |exercise| %>
12-
<dd><%= link_to exercise.title, exercise_path(exercise) %></dd>
12+
<% if exercise %>
13+
<dd><%= link_to exercise.title, exercise_path(exercise) %></dd>
14+
<% end %>
1315
<% end %>
1416
<% else%>
1517
<dd> <%= 'No exercises added' %></dd>

app/views/collections/index.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
<td><%= collection.title %></td>
1919
<% if collection.exercises %>
2020
<% collection.exercises.each do |exercise| %>
21-
<td><%= link_to exercise.title, exercise_path(exercise) %></td>
21+
<%if exercise%>
22+
<td><%= link_to exercise.title, exercise_path(exercise) %></td>
23+
<% end %>
2224
<% end %>
2325
<% else%>
2426
<td> <%= 'No exercises added' %></td>

0 commit comments

Comments
 (0)