0

我为消息系统创建了一个 Redmine 插件。除了消息,用户还可以附加文件。为此,我正在尝试使用现有的 AttachmentsHelper。

这是我的示例代码

在 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  %>

在我的控制器.rb

class CommunicationsController < ApplicationController
unloadable
include AttachmentsHelper

def create
 #code for saving message
end

end

上面的代码不起作用,我也没有收到任何错误。我错过了什么?

谁能帮我解决这个问题?

4

2 回答 2

2

你应该使用

helper :attachments_helper
于 2012-04-28T09:05:27.313 回答
1

在你的 redmine 插件中使用现有的助手。尝试添加

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

在控制器的顶部

于 2012-04-20T17:11:24.747 回答