Karthi Ponnusamy
Karthi Ponnusamy

Reputation: 2031

Redmine Plugin - How to use existing helper

I am created a Redmine plug in for message system. Along with messages user can able to attach files. For that purpose I am trying to use existing AttachmentsHelper.

Here is my sample code

in index.html.erb

<% if not @members.blank? %>

<% form_for :note, @note, :url => {:action => 'create', :project_id => @project.id}, :html => {:multipart => true, :id => 'note-form'} do |f| %>

  <%= f.hidden_field :p_id, :value => @project.id %>
  <p><%= f.text_area :content, :cols => 40, :rows => 6, :class => 'wiki-edit', :id => 'message_content' %></p>
  <p> <%= render :partial => 'attachments/form' %></p>
  <%= submit_tag l(:button_create) %>

<% end %>

<% end  %>

in my controller.rb

class CommunicationsController < ApplicationController
unloadable
include AttachmentsHelper

def create
 #code for saving message
end

end

The above code not working and also I din't get any error. What i am missing?

Can any one help me to solve this issue?

Upvotes: 0

Views: 1095

Answers (2)

Kirill Bezrukov
Kirill Bezrukov

Reputation: 607

You should use

helper :attachments_helper

Upvotes: 2

hitesh israni
hitesh israni

Reputation: 1752

To use existing helpers in your redmine plugin. Try adding

require File.dirname(__FILE__) + '/../../../../../app/helpers/attachments_helper'

at the top of your controller

Upvotes: 1

Related Questions