diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index ad7a7f8..e28a0e8 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -1,11 +1,5 @@ class ArchivesController < ApplicationController #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 serve_path=File.expand_path("../../assets/javascripts/archive/pdf/bcmaps/#{params[:file_name]}.#{params[:extension]}",__FILE__) if Dir.glob(serve_path).length != 0 diff --git a/lib/archive/engine.rb b/lib/archive/engine.rb index bdfc3d3..2ac93af 100644 --- a/lib/archive/engine.rb +++ b/lib/archive/engine.rb @@ -3,6 +3,12 @@ module Archive initializer "archive" do 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/module_app"