mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05:00
FEATURE: Create a rake task for destroying categories
Created a rake task for destroying multiple categories along with any subcategories and topics the belong to those categories. Also created a rake task for listing all of your categories. Refactored existing destroy rake tasks to use new logging method, that allows for puts output in the console but prevents it from showing in the specs.
This commit is contained in:
@@ -36,3 +36,11 @@ end
|
||||
def print_status(current, max)
|
||||
print "\r%9d / %d (%5.1f%%)" % [current, max, ((current.to_f / max.to_f) * 100).round(1)]
|
||||
end
|
||||
|
||||
desc "Output a list of categories"
|
||||
task "categories:list" => :environment do
|
||||
categories = Category.pluck(:id, :slug, :parent_category_id)
|
||||
categories.each do |c|
|
||||
puts "id: #{c[0]}, slug: #{c[1]}, parent: #{c[2]}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user