Project

General

Profile

Add helper to Redmine core

Added by Alexander Gornov about 10 years ago

Hello!
Im have some issue with create helpers in my plugin.
I place my helper in /app/helpers/issue_helper.rb:

module IssueHelper
  #Helpers method here
end

in /lib/redmine_issue_checklist/patches/add_helpers_for_checklists_patch.rb:

module RedmineIssueChecklist
  module Patches

    module AddHelpersForChecklistPatch
      def self.apply(controller)
        controller.send(:helper, 'issue')
      end
    end
  end
end

[SettingsController, ProjectsController].each do |controller|
  RedmineIssueChecklist::Patches::AddHelpersForChecklistPatch.apply(controller)
end

Also, in /lib/redmine_issue_checklist/redmine_issue_checklist.rb

Rails.configuration.to_prepare do  
  ...
  require 'redmine_issue_checklist/patches/add_helpers_for_checklists_patch'
  ...
end

Then i add hook to new issue form, and i use my helpers.
And i get error as result: undefined method.

I can't google some documentation or guides, so any help is appreciated.
Thank you.