adds rake task to recalculate all comment counts in proposals and comments

This commit is contained in:
kikito
2015-09-18 10:33:00 +02:00
parent 793bc52d00
commit af1b2fc217

9
lib/tasks/comments.rake Normal file
View File

@@ -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