Defect #9778

No route matches controller knowledgebase

Added by Mario Luzeiro 5 months ago. Updated 9 days ago.

Status:Reopened Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Affected version:devel Resolution:Invalid

Description

My redmine was workin in rev8131, now I update for last trunk (8191) and seams to be a problem with "knowledgebase" plugin.

Processing WelcomeController#index (for 192.168.3.70 at 2011-12-12 10:04:21) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}
Rendering template within layouts/base
Rendering welcome/index
Rendering welcome/news
Rendering welcome/projects

ActionView::TemplateError (No route matches {:controller=>"knowledgebase", :action=>"index"}) on line #35 of app/views/layouts/base.html.erb:
32:            'div',
33:            "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe,
34:            :id => 'loggedas') if User.current.logged? %>
35:     <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
36: </div>
37: 
38: <div id="header">

    lib/redmine/menu_manager.rb:237:in `render_single_menu_node'
    lib/redmine/menu_manager.rb:189:in `render_menu_node'
    lib/redmine/menu_manager.rb:178:in `render_menu'
    lib/redmine/menu_manager.rb:255:in `menu_items_for'
    lib/redmine/menu_manager.rb:252:in `each'
    lib/redmine/menu_manager.rb:252:in `menu_items_for'
    lib/redmine/menu_manager.rb:177:in `render_menu'
    app/views/layouts/base.html.erb:35

Related issues

duplicated by Defect #9822: ActionView::TemplateError (No route matches {:controller=... Closed

History

#1 Updated by Alex Bevilacqua 5 months ago

It appears that r8157 broke this plugin. The following patch resolves the issue, but since they've removed the default routes, they're is likely a better long-term fix:

 1diff --git a/config/routes.rb b/config/routes.rb
 2index 8b40a4f..15c10a6 100644
 3--- a/config/routes.rb
 4+++ b/config/routes.rb
 5@@ -256,7 +256,8 @@ ActionController::Routing::Routes.draw do |map|
 6   end
 7
 8   map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
 9-
10+  map.connect ':controller/:action/:id'
11+  
12   # Used for OpenID
13   map.root :controller => 'account', :action => 'login'
14 end

#2 Updated by Alex Bevilacqua 5 months ago

I meant r8162 in the above comment (not r8157)

#3 Updated by Mario Luzeiro 5 months ago

I found that there are problems with other all my plugins in my system. It apears first with "knowledgebase" plugin because it is the first plugin to load, I remove it and then, there are other same like problems.
I have merged back (revert) to r8141 and everything is back to normal (I hope!)

#4 Updated by Etienne Massip 5 months ago

You only have to add back the default route (':controller/:action/:id') in your config/routes.rb file as Alex suggested and everything will work as before.

#5 Updated by Alex Bevilacqua 5 months ago

I'm assuming that any plugins that hook into the menu are going to have this issue. Is there a better (official) solution to this than patching the routes?

#6 Updated by Etienne Massip 5 months ago

This has nothing to do with the menu; the cleanest way to deal with routes for plugins, just as Redmine core, is to declare them explicitly in their own config/routes.rb and to use the correct Redmine routes.

The problem with the default route is that it allows the use of several ways to the same controller action which is potentially not safe and is error prone, see fixed code in core because of this removal.

#7 Updated by Mischa The Evil 5 months ago

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

Issue is not related to the Redmine core; closing as such. Thanks for all the input on this matter.

#8 Updated by Roland Discein 4 months ago

  • Status changed from Closed to Reopened

And what we shall do?
r8162 completely brake many plugins installed!

#9 Updated by Etienne Massip 4 months ago

  • Status changed from Reopened to Closed

Ask plugin authors to fix them?

#10 Updated by Brad Rushworth 27 days ago

Etienne Massip wrote:

Ask plugin authors to fix them?

While I'm grateful that I finally found this thread, I've wasted many hours after upgrading to Redmine 1.4 trying to work out why some of my plugins stopped working. Couldn't this be prominently displayed in the upgrading documentation or something? What a huge waste of time for something so trivial...

#11 Updated by Marc Mengel 9 days ago

  • Status changed from Closed to Reopened

Yes, please can we put this in the 1.4 documentation. It took me several hours to find this thread.

Also, we should add a note to the 1.4 docs telling the plugin developers what to add to the
plugins so this workaround will not be needed. While this is otherwise the Right Thing to do,
it does break lots of existing plugins, and it needs to be documented and broadcast appropriately.

Also available in: Atom PDF