我正在为 redmine 创建插件。我需要在项目控制器中添加操作。我为ProjectsControllers做了一个补丁
module ProjectsControllerPatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
end
module ClassMethods
end
module InstanceMethod
def new_method
end
end
end
# Add module to Issue
ProjectsController.send(:include, ProjectsControllerPatch)
并在 routes.rb 中添加了路由:
get 'new_method', :to => 'projets#new_method'
但我在这条路线上有 404 错误