diff --git a/init.rb b/init.rb index 91f56d5..87cbaf3 100644 --- a/init.rb +++ b/init.rb @@ -4,7 +4,11 @@ # Patches to the Redmine core. require 'dispatcher' unless Rails::VERSION::MAJOR >= 3 -if Rails::VERSION::MAJOR >= 3 +if Rails::VERSION::MAJOR >= 5 + ActiveSupport::Reloader.to_prepare do + require_dependency 'redmine_incoming_emails/patches/mail_handler_patch' + end +elsif Rails::VERSION::MAJOR >= 3 ActionDispatch::Callbacks.to_prepare do require_dependency 'redmine_incoming_emails/patches/mail_handler_patch' end diff --git a/lib/redmine_incoming_emails/patches/mail_handler_patch.rb b/lib/redmine_incoming_emails/patches/mail_handler_patch.rb index 9ffe80b..b7347b2 100644 --- a/lib/redmine_incoming_emails/patches/mail_handler_patch.rb +++ b/lib/redmine_incoming_emails/patches/mail_handler_patch.rb @@ -11,7 +11,8 @@ def self.included(base) # :nodoc: base.class_eval do unloadable - alias_method_chain :target_project, :user_specific_defaults + alias_method :target_project_without_user_specific_defaults, :target_project + alias_method :target_project, :target_project_with_user_specific_defaults end end