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

私のcontroller.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 に答える