From 4cb636d8b20dc7cae647d36562dfcd14f25af988 Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 26 May 2020 20:44:36 +0800 Subject: [PATCH] execute check only when first load --- app/controllers/archives_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index de151eb..17288da 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -1,7 +1,7 @@ class ArchivesController < ApplicationController - def index - #avoid the categories to be not in the ArchiveCategory - check_cat_sort_data() + #avoid the categories to be not in the ArchiveCategory + check_cat_sort_data() + def index if ArchiveSortOrder.count == 0 ArchiveSortOrder.new('sort_order' => false).save end @@ -264,7 +264,6 @@ F cats = files_by_cateogry.keys.collect do |cat| end def widget - check_cat_sort_data() if ArchiveSortOrder.count == 0 ArchiveSortOrder.new('sort_order' => false).save end