Adds rake task for recalculating tag custom counters

This commit is contained in:
kikito
2015-09-17 16:59:15 +02:00
parent f9101b4970
commit d6db2387b9

11
lib/tasks/tags.rake Normal file
View File

@@ -0,0 +1,11 @@
namespace :tags do
desc "Recalculates the debate and proposals counters"
task custom_count: :environment do
ActsAsTaggableOn::Tag.find_in_batches do |tasks|
tasks.each do |task|
task.recalculate_custom_counter_for('Debate')
task.recalculate_custom_counter_for('Proposal')
end
end
end
end