From b344e5ee61b143d88db1c5a0f2efd706529b3658 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 11 Jun 2020 17:22:34 +0800 Subject: [PATCH] Fix no content in index page problem. --- app/controllers/archives_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 7ffb05e..47d2165 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -340,8 +340,8 @@ F cats = files_by_cateogry.keys.collect do |cat| end private def get_sorted_cat_with_filter(categories,cat_type) - all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil).uniq!{|c| c.category_id }.to_a rescue [] - all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc').uniq!{|c| c.category_id }.to_a rescue [] + all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil).uniq{|c| c.category_id }.to_a rescue [] + all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc').uniq{|c| c.category_id }.to_a rescue [] all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat| cat.category_id.to_s end