From af1b2fc217a69dc74896e1c9d8a8ac72d627f4f8 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 18 Sep 2015 10:33:00 +0200 Subject: [PATCH] adds rake task to recalculate all comment counts in proposals and comments --- lib/tasks/comments.rake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/tasks/comments.rake diff --git a/lib/tasks/comments.rake b/lib/tasks/comments.rake new file mode 100644 index 000000000..6c3f32687 --- /dev/null +++ b/lib/tasks/comments.rake @@ -0,0 +1,9 @@ +namespace :comments do + + desc "Recalculates all the comment counters for debates and proposals" + task count: :environment do + Debate.all.pluck(:id).each{ |id| Debate.reset_counters(id, :comments) } + Proposal.all.pluck(:id).each{ |id| Proposal.reset_counters(id, :comments) } + end + +end