From d6db2387b90702996c1407ea1afc3520831d27c5 Mon Sep 17 00:00:00 2001 From: kikito Date: Thu, 17 Sep 2015 16:59:15 +0200 Subject: [PATCH] Adds rake task for recalculating tag custom counters --- lib/tasks/tags.rake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/tasks/tags.rake diff --git a/lib/tasks/tags.rake b/lib/tasks/tags.rake new file mode 100644 index 000000000..c4af963cc --- /dev/null +++ b/lib/tasks/tags.rake @@ -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