I've already asked the question on the Redmine official website but I didn't get any answer, maybe I'll have more chance here.
I'm working on a project and I try to improve an existing plugin for Redmine by adding some features to it to allow the user to upload his Dropbox files in the Redmine documents with a simple form. Redmine already has this possibilty so I would like to use the controller and methods already defined in the Redmine source code.
I have the following code in one of my plugin views:
<% 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 %>
I'm calling the "documents" controller and the add_attachment
method which are defined in the Redmine source code. When I submit my form I get the following error:
ActionController::RoutingError (No route matches {:controller=>"documents", :action=>"add_attachment", :id=>nil}):
Is it possible to call these controllers/methods through a plugin if they are defined in the Redmine source code?
If yes, maybe could you give some advice to how configure my routes?
Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database. Redmine is open source and released under the terms of the GNU General Public License v2 (GPL).
In any text field you can mention user. To do this, type «@» symbol and start typing the name. You will see list with available variants. Search is performed by surname, first name and user login.
Under Administration > Settings you can edit the text which is shown on the welcome page. It follows the same formatting rules like a wiki page so you can easily create a table with textile or markdown depending on your settings. You can also insert the table as an image.
See here :id => @document
@document
is the variable that contains nil
however this should contain some id
(like 1,2 or whatever) of required record check it in your controller and once you will fix this issue sure this error will be resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With