adds rake task to recalculate all comment counts in proposals and comments
This commit is contained in:
9
lib/tasks/comments.rake
Normal file
9
lib/tasks/comments.rake
Normal 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
|
||||||
Reference in New Issue
Block a user