Ruby on rails 从插件修补Rails应用程序(Redmine)
我正在尝试为Rails 3上的Redmine 2.5.0编写一个验证程序插件。插件应该检查Ruby on rails 从插件修补Rails应用程序(Redmine),ruby-on-rails,ruby,ruby-on-rails-3,redmine,Ruby On Rails,Ruby,Ruby On Rails 3,Redmine,我正在尝试为Rails 3上的Redmine 2.5.0编写一个验证程序插件。插件应该检查问题的一些值,并在不满足条件的情况下禁止更新。我已经编写了插件代码,但不知何故我无法让Redmine接受我所做的更改 我有以下插件项目: product_release_control |_ config |_ lib | |_ patches | |_ issues_patch.rb |_ init.rb 和init.rb如下所示: #encoding: utf-8 requi
问题的一些值,并在不满足条件的情况下禁止更新。我已经编写了插件代码,但不知何故我无法让Redmine接受我所做的更改
我有以下插件项目:
product_release_control
|_ config
|_ lib
| |_ patches
| |_ issues_patch.rb
|_ init.rb
和init.rb
如下所示:
#encoding: utf-8
require 'patches/issues_patch'
Redmine::Plugin.register :product_release_control do
name 'Product Release Control plugin'
author 'Author name'
description '...'
version '0.0.1'
end
问题是,在执行rake redmine:plugins:migrate
并重新加载apache之后,我看不到任何更改。当我运行Issue.included_modules
时,我在列表中看不到我的模块
我还尝试将ActionDispatch部分移动到init.rb,但这会给我
未初始化的常量ProductReleaseControl
。那么,我如何在Redmine中包含我的补丁呢?对于以前的Redmine版本,我编写了Rails.configuration.to_prepare
See@gotva,这应该适用于Rails2,而我的Redmine版本在Rails3上,应该是ActionDispatch::Callbacks.to_prepare do
给定的示例适用于Redmine 2.2(它是第三条Rails)。但我查看了一些redmine教程,我发现他们建议,若模块还并没有包括在内,就发送补丁。看看这个(boards\u watchers\u patches.rb的代码)
#encoding: utf-8
require 'patches/issues_patch'
Redmine::Plugin.register :product_release_control do
name 'Product Release Control plugin'
author 'Author name'
description '...'
version '0.0.1'
end