我已经在Redmine官网提过这个问题了,但是没有得到任何答复,也许我在这里会有更多的机会。
我正在开发一个项目,并尝试改进 existing plugin为Redmine添加了一些功能,允许用户通过简单的形式在Redmine文档中上传他的Dropbox文件。 Redmine 已经有这种可能性,所以我想使用 Redmine 源代码中已经定义的 Controller 和方法。
我的插件 View 之一中有以下代码:
<% html_title "Reddrop - Sync" %>
<h2>Synchronisation page</h2>
<p>Please choose your file</p>
<%= form_tag({:controller => "documents", :action => "add_attachment", :id => @document}, :multipart => true) do %>
<%= file_field_tag 'attachments[dummy][file]', :id => nil, :multiple => true, :onchange => "addInputFiles(this)" %>
<%= submit_tag(value = "Sync this file with Redmine") %>
<% end %>
我正在调用Redmine源代码中定义的“文档” Controller 和add_attachment
方法。当我提交表单时,出现以下错误:
ActionController::RoutingError (No route matches {:controller=>"documents", :action=>"add_attachment", :id=>nil}):
如果这些 Controller /方法在Redmine源代码中定义,是否可以通过插件调用它们?
如果是的话,您能否就如何配置我的路线提供一些建议?
最佳答案
参见此处:id => @document
@document
是包含 nil
的变量,但是它应该包含所需记录的一些 id
(如 1,2 或其他),请在您的文件中检查它 Controller ,一旦您修复此问题,请确保此错误将得到解决。
关于ruby-on-rails - 通过插件访问Redmine Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22247117/