execute check only when first load

This commit is contained in:
chiu 2020-05-26 20:44:36 +08:00
parent a6aff16099
commit 4cb636d8b2
1 changed files with 3 additions and 4 deletions

View File

@ -1,7 +1,7 @@
class ArchivesController < ApplicationController class ArchivesController < ApplicationController
def index
#avoid the categories to be not in the ArchiveCategory #avoid the categories to be not in the ArchiveCategory
check_cat_sort_data() check_cat_sort_data()
def index
if ArchiveSortOrder.count == 0 if ArchiveSortOrder.count == 0
ArchiveSortOrder.new('sort_order' => false).save ArchiveSortOrder.new('sort_order' => false).save
end end
@ -264,7 +264,6 @@ F cats = files_by_cateogry.keys.collect do |cat|
end end
def widget def widget
check_cat_sort_data()
if ArchiveSortOrder.count == 0 if ArchiveSortOrder.count == 0
ArchiveSortOrder.new('sort_order' => false).save ArchiveSortOrder.new('sort_order' => false).save
end end