Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes missing for Redmine 1.4.0 #24

Open
cassianomonteiro opened this issue Apr 17, 2012 · 14 comments
Open

Routes missing for Redmine 1.4.0 #24

cassianomonteiro opened this issue Apr 17, 2012 · 14 comments

Comments

@cassianomonteiro
Copy link

The new version of Redmine needs the routes for the plugins, as described in http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial#Generating-a-controller .

Because of the missing router, I'm getting this error:

Processing IssuesController#show (for 10.3.14.32 at 2012-04-17 07:53:41) [GET]
  Parameters: {"action"=>"show", "id"=>"3192", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/show

ActionView::TemplateError (No route matches {:controller=>"importer", :action=>"index", :project_id=>#}) on line #57 of app/views/layouts/base.html.erb:
54: 
55:     <% if display_main_menu?(@project) %>
56:     
57: <%= render_main_menu(@project) %> 58:
59: <% end %> 60: lib/redmine/menu_manager.rb:150:in `render_single_menu_node' lib/redmine/menu_manager.rb:102:in `render_menu_node' lib/redmine/menu_manager.rb:91:in `render_menu' lib/redmine/menu_manager.rb:168:in `menu_items_for' lib/redmine/menu_manager.rb:165:in `each' lib/redmine/menu_manager.rb:165:in `menu_items_for' lib/redmine/menu_manager.rb:90:in `render_menu' lib/redmine/menu_manager.rb:80:in `render_main_menu' app/views/layouts/base.html.erb:57 app/controllers/issues_controller.rb:118:in `show' app/controllers/issues_controller.rb:115:in `show' config/initializers/mongrel.rb:62:in `dispatch_cgi' Rendering C:/webserver/Redmine/public/500.html (500 Internal Server Error)
@cassianomonteiro
Copy link
Author

I corrected that creating the file config/routes.rb with the following mapping:

ActionController::Routing::Routes.draw do |map|
  map.connect '/importer/index', :controller => 'importer', :action => 'index'
end

Are there any other routes used?

@NokSuKao
Copy link

Hi,

yes there are. The next problem is

ActionView::TemplateError (No route matches {:action=>"match"}) on line #3 of vendor/plugins/redmine_importer/app/views/importer/index.html.erb:
1:
2:
3:
4:
5:
6:

vendor/plugins/redmine_importer/app/views/importer/index.html.erb:3
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /usr/share/redmine-1.4/public/500.html (500 Internal Server Error)

NokSuKao

@cassianomonteiro
Copy link
Author

Got it. Any more routes missing?

@NokSuKao
Copy link

Hi,

how did you fix it?

NokSuKao

@cassianomonteiro
Copy link
Author

Create the file config/routes.rb with the following contents:

ActionController::Routing::Routes.draw do |map|
  map.connect '/importer/index', :controller => 'importer', :action => 'index'
  map.connect '/importer/match', :controller => 'importer', :action => 'match'
end

If you have more problems with routes, just add more lines following that pattern.

@archonwang
Copy link

nice.I will check it.

@NokSuKao
Copy link

Hi,

next problem at

ActionView::TemplateError (No route matches {:action=>"result"}) on line #13 of vendor/plugins/redmine_importer/app/views/importer/match.html.erb:
10:
11:
12:
13:
14:
15:
16:

vendor/plugins/redmine_importer/app/views/importer/match.html.erb:13
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /usr/share/redmine-1.4/public/500.html (500 Internal Server Error)

i tried to add

map.connect '/importer/result', :controller => 'importer', :action => 'result'
in the routes.rb. The next Problem is

Processing ImporterController#match (for 192.168.0.154 at 2012-04-18 11:39:14) [POST]
Parameters: {"encoding"=>"U", "project_id"=>"22", "action"=>"match", "authenticity_token"=>"gzx2AfuygDnU4cvRbcXDA+kaSJJZ0RoikpnUGGh5Hbk=", "controller"=>"importer", "file"=>#File:/tmp/RackMultipart20120418-7936-7awara-0, "splitter"=>";", "wrapper"=>"""}

FasterCSV::MalformedCSVError (FasterCSV::MalformedCSVError):
fastercsv (1.5.4) lib/faster_csv.rb:1641:in shift' fastercsv (1.5.4) lib/faster_csv.rb:1632:ineach'
fastercsv (1.5.4) lib/faster_csv.rb:1632:in shift' fastercsv (1.5.4) lib/faster_csv.rb:1599:inloop'
fastercsv (1.5.4) lib/faster_csv.rb:1599:in shift' fastercsv (1.5.4) lib/faster_csv.rb:1544:ineach'
vendor/plugins/redmine_importer/app/controllers/importer_controller.rb:61:in match' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:inprocess_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in main_loop' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:instart_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:insafe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:insend'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:instart_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in start' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:instart'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:inlookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:insynchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in synchronize' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:inspawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in spawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:inhandle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in __send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:inmain_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /usr/share/redmine-1.4/public/500.html (500 Internal Server Error)

NokSuKao

@cassianomonteiro
Copy link
Author

That route seems to work. The problem now is not with routes anymore. As you can see from you message, your CSV file is malformed somehow.

FasterCSV::MalformedCSVError (FasterCSV::MalformedCSVError):

@lbushby
Copy link

lbushby commented Apr 27, 2012

  1. Could someone post a final, fully working routes.rb for 1.4.0 and later?
  2. I'm currently using the lines below. I know very little Ruby and I suspect what I am doing is a bad idea but don't know why. Anyone care to comment?
ActionController::Routing::Routes.draw do |map|
  map.connect ':controller/:action/:id'
end

@cassianomonteiro
Copy link
Author

Your line is wrong. You need to replace the controller and action paths with the ones from the plugin, and their routes. So far, this is the complete routes.rb file I have for this plugin:

ActionController::Routing::Routes.draw do |map|
  map.connect '/importer/index', :controller => 'importer', :action => 'index'
  map.connect '/importer/match', :controller => 'importer', :action => 'match'
  map.connect '/importer/result', :controller => 'importer', :action => 'result'
end

@lbushby
Copy link

lbushby commented Apr 27, 2012

Thank-you.

@archonwang
Copy link

anyone make a pull request? Thanks

@mikewolfli
Copy link

Hello, all!
I think ,if the routes for rails2,and 3, it should be as follow:

if Rails::VERSION::MAJOR >= 3
RedmineApp::Application.routes.draw do
match '/importer/index', :to => 'importer#index', :via => [:get, :post]
match '/importer/index', :to => 'importer#match', :via => [:get, :post]
match '/importer/index', :to => 'importer#result', :via => [:get, :post]
end
else
ActionController::Routing::Routes.draw do |map|
map.connect '/importer/index', :controller => 'importer', :action => 'index'
map.connect '/importer/match', :controller => 'importer', :action => 'match'
map.connect '/importer/result', :controller => 'importer', :action => 'result'
end
end

@buoyant
Copy link

buoyant commented Dec 8, 2012

Hello mikewolfli

Please check this,

RedmineApp::Application.routes.draw do
match '/importer/index', :to => 'importer#index', :via => [:get, :post]
match '/importer/match', :to => 'importer#match', :via => [:get, :post]
match '/importer/result', :to => 'importer#result', :via => [:get, :post]
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants