Update archive_files_controller.rb

fix error
This commit is contained in:
chiu 2019-09-18 21:14:38 +08:00
parent 3b9a0d1232
commit 8b000b9b89
1 changed files with 3 additions and 3 deletions

View File

@ -52,13 +52,13 @@ class Admin::ArchiveFilesController < OrbitAdminController
def categories_order
categories = @module_app.categories
categories.each do |category|
archive_cat = ArchiveCategory.All.select{ |value| value.category_id.to_s == category.id.to_s}
archive_cat = ArchiveCategory.all.select{ |value| value.category_id.to_s == category.id.to_s}
if archive_cat.length == 0
ArchiveCategory.create(category_id: category.id.to_s)
end
end
cats_with_nil = ArchiveCategory.All.in(sort_number: nil)
cats_no_nil = ArchiveCategory.All.not_in(sort_number: nil)
cats_with_nil = ArchiveCategory.all.in(sort_number: nil)
cats_no_nil = ArchiveCategory.all.not_in(sort_number: nil)
@cats = cats_no_nil.concat(cats_with_nil).collect do |cat|
[categories.where(:_id => cat.category_id).first,cat.sort_number.to_s]
end