From ad44d3fbcf3da317ac492f2b64d0d66720cc6388 Mon Sep 17 00:00:00 2001 From: keineahnung2345 Date: Thu, 18 May 2023 17:58:44 +0800 Subject: [PATCH] [fix] Compatible with Rails 6: zeitwerk and search path --- init.rb | 2 ++ .../patches/repositories_controller_patch.rb | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/init.rb b/init.rb index b56cfdd..a07e6f8 100644 --- a/init.rb +++ b/init.rb @@ -10,6 +10,8 @@ end end +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" + require_dependency 'redmine_git_server/hooks' app = Rails.application diff --git a/lib/redmine_git_server/patches/repositories_controller_patch.rb b/lib/redmine_git_server/patches/repositories_controller_patch.rb index 84dd740..de338da 100644 --- a/lib/redmine_git_server/patches/repositories_controller_patch.rb +++ b/lib/redmine_git_server/patches/repositories_controller_patch.rb @@ -1,12 +1,12 @@ require_dependency 'repositories_controller' -module RepositoriesControllerWithGitServerSupport - - def show_error_not_found - return super if params[:action] != 'show' - render action: 'empty' +module RedmineGitServer::Patches + module RepositoriesControllerPatch + def show_error_not_found + return super if params[:action] != 'show' + render action: 'empty' + end end - end -RepositoriesController.send(:prepend, RepositoriesControllerWithGitServerSupport) +RepositoriesController.send(:prepend, RedmineGitServer::Patches::RepositoriesControllerPatch)