From df55e5bac49d20605fb263d1c1a5a310a46298a9 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 16 Aug 2018 14:00:07 +0530 Subject: [PATCH] optimize categories:create_definition task --- lib/tasks/categories.rake | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/tasks/categories.rake b/lib/tasks/categories.rake index dd7ede720c5..d58522657e8 100644 --- a/lib/tasks/categories.rake +++ b/lib/tasks/categories.rake @@ -26,19 +26,9 @@ task "categories:create_definition" => :environment do puts "Creating category definitions" puts - done = 0 - current = 0 - total = Category.count + Category.where(topic_id: nil).each(&:create_category_definition) - Category.find_each do |c| - if c.topic_id.blank? - c.create_category_definition - done += 1 - end - print_status(current += 1, total) - end - - puts "", "category definition created for #{done} categories!", "" + puts "", "Done!", "" end