Defect #22048

Exception throws during plugin rendering

Added by Andrey Iskousnykh almost 7 years ago. Updated almost 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-
Resolution:Duplicate Affected version:

Description

The following code in redmine\app\views\layouts\base.html.erb at 28th line will throw ActionController::UrlGenerationError when plugin has controller with namespace in routing.

<%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>

A part from route.rb of plugin:

RedmineApp::Application.routes.draw do
  #...
  get 'projects/:project_id/reports/admin'
  #...
end

This is not the only source of this error, because of :controller parameter is used in relative form, so any usage of ActionController::Base#url_for would throw an error (e.g. during menu generation).

The only way for a while to bypass the error is to avoid namespaces in plugins.

To produce an error you need to generate a plugin with controller using namespaces, like Reports::BadPluginController < ApplicationController, which action renders as redmine part (using standard redmine layout), and route to it get 'projects/:project_id/reports/bad_plugin'.

Met at

Environment:
  Redmine version                3.2.0.stable
  Ruby version                   2.1.5-p273 (2014-11-13) [i386-mingw32]
  Rails version                  4.2.5.1
  Environment                    development
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.5
  Filesystem


Related issues

Duplicates Redmine - Defect #15872: url_for causes routing problems if a plugin uses namespaces New

History

#1 Updated by Toshi MARUYAMA almost 7 years ago

  • Category set to Plugin API

#2 Updated by Go MAEDA almost 4 years ago

  • Duplicates Defect #15872: url_for causes routing problems if a plugin uses namespaces added

#3 Updated by Go MAEDA almost 4 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closing as a duplicate of #15872.

Also available in: Atom PDF