3

I'm writing a plugin for redmine and there is one thing i just don't get:

I have a helpermodule called approvals_helper.rb which contains a method 'rev_approved?'

module ApprovalsHelper  
  def rev_approved?(repository, revision)      
    # return some boolean value
  end  
end

Now i want to use this method in my view which is a partial and is called _approved.html.erb

<% if rev_approved?(@repository, @revision) %>
     <p>show something</p>
<% end %>

This partial is rendered in the revision.html.erb (from redmine view/repositories)

But when i do i get this error message:

ActionView::Template::Error (undefined method `rev_approved?' for #<#<Class:0x7f801e6bf030>:0x7f801e669ae0>)

When i add "include ApprovalsHelper" directly to the ApplicationHelper it all works fine, but i don't want to change the code directly. Is there a way to do this in a my plugin? Is this because i actually render my partial in the revision view? How can I get this to work?

I'm using redmine 2.3.1 , ruby 1.8.7 and rails 3.2.13

Many thanks!

A.L.
  • 129
  • 1
  • 7

1 Answers1

1

in your init.rb add

require_dependency 'name_of_helper'
Noma4i
  • 751
  • 7
  • 19