Display total

This commit is contained in:
Manuel Bustillo 2024-07-11 20:03:49 +02:00
parent 4a31153dc8
commit 8bac32bb77

View File

@ -15,7 +15,14 @@
<td><%= expense.amount %></td> <td><%= expense.amount %></td>
<td><%= link_to "Show", expense %></td> <td><%= link_to "Show", expense %></td>
<td><%= link_to "Edit", edit_expense_path(expense) %></td> <td><%= link_to "Edit", edit_expense_path(expense) %></td>
</tr>
<% end %> <% end %>
<tr>
<td>Total</td>
<td><%= @expenses.sum(&:amount) %></td>
<td colspan="2"></td>
</tr>
</table>
</div> </div>
<%= link_to "New expense", new_expense_path %> <%= link_to "New expense", new_expense_path %>