redmine_importer
redmine_importer copied to clipboard
Routes missing for Redmine 1.4.0
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: 56: 59: 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)
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?
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
Got it. Any more routes missing?
Hi,
how did you fix it?
NokSuKao
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.
nice.I will check it.
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:in
each'
fastercsv (1.5.4) lib/faster_csv.rb:1632:in shift' fastercsv (1.5.4) lib/faster_csv.rb:1599:in
loop'
fastercsv (1.5.4) lib/faster_csv.rb:1599:in shift' fastercsv (1.5.4) lib/faster_csv.rb:1544:in
each'
vendor/plugins/redmine_importer/app/controllers/importer_controller.rb:61:in match' /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
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):
- Could someone post a final, fully working routes.rb for 1.4.0 and later?
- 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
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
Thank-you.
anyone make a pull request? Thanks
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
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