Create two plugins, one named 'test_001', another is 'test_002'.
test_001¶
# init.rbRails.configuration.to_preparedorequire'test_issues_controller_patch'endRedmine::Plugin.register:test_001doname'Test 001 plugin'author'Author name'description'This is a plugin for Redmine'version'0.0.1'url'http://example.com/path/to/plugin'author_url'http://example.com/about'end# lib/test_issues_controller_patch.rbmoduleTestIssuesControllerPatchextendActiveSupport::ConcernincludeddoendendunlessIssuesController.included_modules.include?(TestIssuesControllerPatch)IssuesController.send:include,TestIssuesControllerPatchend
test_002¶
# init.rbRails.configuration.to_preparedorequire'test_hooks'require'test_issues_helper_patch'end# Rails.configuration.to_prepareRedmine::Plugin.register:test_002doname'Test 002 plugin'author'Author name'description'This is a plugin for Redmine'version'0.0.1'url'http://example.com/path/to/plugin'author_url'http://example.com/about'end# lib/test_issues_helper_patch.rbmoduleTestIssuesHelperPatchextendActiveSupport::Concernincludeddoenddeftest_hello'hello world'endendunlessIssuesHelper.included_modules.include?(TestIssuesHelperPatch)IssuesHelper.send:include,TestIssuesHelperPatchend# lib/test_hooks.rbclassTestHooks<Redmine::Hook::ViewListenerdefview_issues_show_details_bottom(context={})context[:hook_caller].instance_evaldorender(:partial=>'test/hello_world')endendend# app/views/test/_hello_world.html.rb<%= test_hello %>
If everything is OK, 'hello world' should be displayed in issue detail page.
BUT I see:
ActionView::Template::Error (undefined local variable or method `test_hello' for #<#<Class:0x007fca71f0bd90>:0x007fca71f00760>): 1: <%= test_hello %> plugins/test_002/app/views/test/_hello_world.html.erb:1:in `_plugins_test_____app_views_test__hello_world_html_erb__3192427753573044533_70253770942940' plugins/test_002/lib/test_hooks.rb:4:in `block in view_issues_show_details_bottom' plugins/test_002/lib/test_hooks.rb:3:in `instance_eval' plugins/test_002/lib/test_hooks.rb:3:in `view_issues_show_details_bottom' lib/redmine/hook.rb:61:in `block (2 levels) in call_hook' lib/redmine/hook.rb:61:in `each' lib/redmine/hook.rb:61:in `block in call_hook' lib/redmine/hook.rb:58:in `tap' lib/redmine/hook.rb:58:in `call_hook' lib/redmine/hook.rb:96:in `call_hook' app/views/issues/show.html.erb:70:in `_app_views_issues_show_html_erb__1203365146500478953_70253735647440' app/controllers/issues_controller.rb:111:in `block (2 levels) in show' app/controllers/issues_controller.rb:104:in `show' lib/redmine/sudo_mode.rb:63:in `sudo_mode'
If I disable test_001, or rename test_002 to test_000,it's work.
It seems that controller patch make helper patch failed.