Plugin conflict: helper method included by one plugin seems to disappear when another plugin is present
I'm using the "CoreHelper.send(:include, MyHelper)" call mentioned in:
to add one extra helper method named issue_history_tabs_for_redmine_rt for the issue view:
This works fine.
However, if I add some other plugin like this one:
the method issue_history_tabs_for_redmine_rt disappears:
Rendered plugins/mega_calendar/app/views/issues/show.html.erb (500.0ms)
Rendered plugins/redmine_rt/app/views/issues/show.html.erb within layouts/base
Completed 500 Internal Server Error in 1810ms (ActiveRecord: 38.2ms)
ActionView::Template::Error (undefined local variable or method `issue_history_tabs_for_redmine_rt' for #<#<Class:0x00007f009593f048>:0x00007f0095923c80>
Did you mean? issue_history_tabs):
221: " >
222: <div id="history" data-comment_sorting="<=
User.current.wants_comments_in_reverse_order? ? 'desc' : 'asc' >">
223: <= render_tabs issue_history_tabs_for_redmine_rt, issue_history_default_tab >
225: < end %>
app/controllers/issues_controller.rb:112:in `block (2 levels) in show'
I checked the code for the mega_calendar plugin but could not find what would be causing this (I was thinking maybe it patches the IssuesHelper too but it doesn't).
The same happens if I remove mega_calendar and add:
Does anyone have any clue about what would be causing this?
RE: Plugin conflict: helper method included by one plugin seems to disappear when another plugin is present - Added by Mayama Takeshi 9 months ago
Doing some tests I realized the problem happens because the other plugin also patches IssuesController.
The patch for this controller can even be blank like this:
require_dependency 'issues_controller' module MegaCalendar module IssuesControllerPatch end end
and it is enough for the plugin to do this in its init.rb file:
for the problem to happen.
It is not necessary to do:
So there is some rails magic at play here maybe based on the Patch suffix and it seems the IssuesHelper module is reset.
But, I realized I don't need to patch IssuesHelper and instead I just moved the method issue_history_tabs_for_redmine_rt from IssuesHelperPatch to my IssuesControllerPatch.
And after that the problem stopped happening (ref: https://github.com/MayamaTakeshi/redmine_rt/issues/5).
Anyway, I'll be glad to hear if someone can explain this behavior (I am not a rails/ruby dev by trade).