From 450fcc3e044061711d833c20876c8dde12f53069 Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Thu, 5 Jan 2017 11:14:12 +0100 Subject: [PATCH] Use SQL to sum the comments --- app/models/legislation/process.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 0a264203c..458b48ed3 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -56,7 +56,7 @@ class Legislation::Process < ActiveRecord::Base end def total_comments - questions.map(&:comments_count).sum + questions.sum(:comments_count) end def status