Adds rake task for recalculating tag custom counters
This commit is contained in:
11
lib/tasks/tags.rake
Normal file
11
lib/tasks/tags.rake
Normal 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
|
||||
Reference in New Issue
Block a user