From 706624c9fcaf0b10b2d1ada952c5a177b9bedf59 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 30 May 2016 13:59:16 +1000 Subject: [PATCH] workaround incorrect uncategorized category id set in site settings --- db/fixtures/001_categories.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/fixtures/001_categories.rb b/db/fixtures/001_categories.rb index edc23155f..c6880b533 100644 --- a/db/fixtures/001_categories.rb +++ b/db/fixtures/001_categories.rb @@ -2,7 +2,10 @@ ActiveRecord::Base.send(:subclasses).each{|m| m.reset_column_information} SiteSetting.refresh! -if SiteSetting.uncategorized_category_id == -1 || !Category.exists?(SiteSetting.uncategorized_category_id) +uncat_id = SiteSetting.uncategorized_category_id +uncat_id = -1 unless Numeric === uncat_id + +if uncat_id == -1 || !Category.exists?(uncat_id) puts "Seeding uncategorized category!" result = Category.exec_sql "SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'"