ruby-on-rails - 通过插件访问Redmine Controller

标签 ruby-on-rails plugins redmine

我已经在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/

相关文章:

ruby-on-rails - Rails 3中的作用域与类方法

android - Xamarin 是否足以开发社交平台应用程序?

testing - 如何在redmine中编写测试用例和测试步骤

gitsosis, redmine, 乘客 : 'not a git repository' error

linux - 使用 Redmine Ticket 提交消息

ruby-on-rails - Rails关系一对多;无法构建子对象?

ruby-on-rails - 闪光[:notice] not working when using AJAX in Rails

css - Bootstrap : Hovering over button with custom color not changing styling

php - 在 PHP 插件中包含第三方库时避免类名冲突的模式?

css - 如何使用 Notepad++ 将 css long 转换为 css one line style