fix error

This commit is contained in:
chiu 2021-09-09 15:27:14 +08:00
parent 209903f35d
commit eca64d50cc
2 changed files with 6 additions and 6 deletions

View File

@ -1,11 +1,5 @@
class ArchivesController < ApplicationController class ArchivesController < ApplicationController
#avoid the categories to be not in the ArchiveCategory #avoid the categories to be not in the ArchiveCategory
before_action :set_archive_sort_order, only: [:index, :widget]
def set_archive_sort_order
if ArchiveSortOrder.count == 0
ArchiveSortOrder.new('sort_order' => false).save
end
end
def serve_cmap def serve_cmap
serve_path=File.expand_path("../../assets/javascripts/archive/pdf/bcmaps/#{params[:file_name]}.#{params[:extension]}",__FILE__) serve_path=File.expand_path("../../assets/javascripts/archive/pdf/bcmaps/#{params[:file_name]}.#{params[:extension]}",__FILE__)
if Dir.glob(serve_path).length != 0 if Dir.glob(serve_path).length != 0

View File

@ -3,6 +3,12 @@ module Archive
initializer "archive" do initializer "archive" do
require File.expand_path('../../../app/models/archive_category', __FILE__) require File.expand_path('../../../app/models/archive_category', __FILE__)
require File.expand_path('../../../app/models/archive_sort_order', __FILE__)
if defined?(ArchiveSortOrder)
if ArchiveSortOrder.count == 0
ArchiveSortOrder.create('sort_order' => false)
end
end
require "#{ENV['PWD']}/app/models/category" require "#{ENV['PWD']}/app/models/category"
require "#{ENV['PWD']}/app/models/module_app" require "#{ENV['PWD']}/app/models/module_app"