From 8bac32bb7704ac7c6e95bfecd466e8d679eec908 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 11 Jul 2024 20:03:49 +0200 Subject: [PATCH] Display total --- app/views/expenses/index.html.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/views/expenses/index.html.erb b/app/views/expenses/index.html.erb index 589b9c1..a55b835 100644 --- a/app/views/expenses/index.html.erb +++ b/app/views/expenses/index.html.erb @@ -15,7 +15,14 @@ <%= expense.amount %> <%= link_to "Show", expense %> <%= link_to "Edit", edit_expense_path(expense) %> + <% end %> + + Total + <%= @expenses.sum(&:amount) %> + + + <%= link_to "New expense", new_expense_path %>