From aebc4981445a5afb2d3897ea21b79826f473ca3f Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 26 May 2020 20:48:24 +0800 Subject: [PATCH] fix error --- app/controllers/archives_controller.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 518511f..f2e9137 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -1,15 +1,12 @@ class ArchivesController < ApplicationController - def check_cat_sort_data - categories_temp = ModuleApp.where(:key => "archive").first.categories - categories_temp.each do |category| - archive_cat = ArchiveCategory.where(:category_id => category.id) - if archive_cat.count == 0 - ArchiveCategory.create(category_id: category.id.to_s) - end + #avoid the categories to be not in the ArchiveCategory + categories_temp = ModuleApp.where(:key => "archive").first.categories + categories_temp.each do |category| + archive_cat = ArchiveCategory.where(:category_id => category.id) + if archive_cat.count == 0 + ArchiveCategory.create(category_id: category.id.to_s) end end - #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