abahgat / redmine_didyoumean

A Redmine plugin to search for possible duplicates when users are about to open new issues.
Other
67 stars 46 forks source link

Needs adaptation for Redmine 2.5 (no "match" route) #66

Open onlyjob opened 9 years ago

onlyjob commented 9 years ago

On Debian "Jessie" Redmine-2.5.2.devel fails to start with the following error:

An error occurred while loading the routes definition of redmine_didyoumean plugin (/usr/share/redmine/plugins/redmine_didyoumean/config/routes.rb):
You should not use the `match` method in your router without specifying an HTTP method.
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
  Instead of: match "controller#action"
  Do: get "controller#action".
onlyjob commented 9 years ago

The following trivial patch fixes this issue

--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,6 @@
   ActionController::Routing::Routes.draw do |map|
     map.plugin_route 'searchissues', :controller => "search_issues", :action => 'index'
   end
 else
-  match 'searchissues', :controller => "search_issues", :action => 'index'
+  get 'searchissues', :controller => "search_issues", :action => 'index'
 end

but then it crashes with "wrong number of arguments":

tarted GET "/rm/searchissues?project_id=6&issue_id=&query=purchase+" for 127.0.0.1 at 2014-11-19 12:55:57 +1100
Processing by SearchIssuesController#index as */*
  Parameters: {"project_id"=>"6", "issue_id"=>"", "query"=>"purchase "}
  Current user: onlyjob (id=3)
Completed 500 Internal Server Error in 6ms

ArgumentError (wrong number of arguments (1 for 0)):
  /usr/lib/ruby/vendor_ruby/active_record/scoping/named.rb:24:in `all'
  plugins/redmine_didyoumean/app/controllers/search_issues_controller.rb:64:in `index'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/implicit_render.rb:4:in `send_action'
  /usr/lib/ruby/vendor_ruby/abstract_controller/base.rb:189:in `process_action'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/rendering.rb:10:in `process_action'
  /usr/lib/ruby/vendor_ruby/abstract_controller/callbacks.rb:20:in `block in process_action'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:113:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:113:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:229:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:229:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:166:in `block in halting'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:86:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:86:in `run_callbacks'
  /usr/lib/ruby/vendor_ruby/abstract_controller/callbacks.rb:19:in `process_action'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/rescue.rb:29:in `process_action'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  /usr/lib/ruby/vendor_ruby/active_support/notifications.rb:159:in `block in instrument'
  /usr/lib/ruby/vendor_ruby/active_support/notifications/instrumenter.rb:20:in `instrument'
  /usr/lib/ruby/vendor_ruby/active_support/notifications.rb:159:in `instrument'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/instrumentation.rb:30:in `process_action'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/params_wrapper.rb:250:in `process_action'
  /usr/lib/ruby/vendor_ruby/active_record/railties/controller_runtime.rb:18:in `process_action'
  /usr/lib/ruby/vendor_ruby/abstract_controller/base.rb:136:in `process'
  /usr/lib/ruby/vendor_ruby/action_view/rendering.rb:30:in `process'
  /usr/lib/ruby/vendor_ruby/action_controller/metal.rb:196:in `dispatch'
  /usr/lib/ruby/vendor_ruby/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  /usr/lib/ruby/vendor_ruby/action_controller/metal.rb:232:in `block in action'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:82:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:82:in `dispatch'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:50:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/journey/router.rb:73:in `block in call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/journey/router.rb:59:in `each'
  /usr/lib/ruby/vendor_ruby/action_dispatch/journey/router.rb:59:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:678:in `call'
  /usr/lib/ruby/vendor_ruby/rack/openid.rb:98:in `call'
  /usr/lib/ruby/vendor_ruby/rack/etag.rb:23:in `call'
  /usr/lib/ruby/vendor_ruby/rack/conditionalget.rb:25:in `call'
  /usr/lib/ruby/vendor_ruby/rack/head.rb:11:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/params_parser.rb:27:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/flash.rb:254:in `call'
  /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:225:in `context'
  /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:220:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/cookies.rb:560:in `call'
  /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:36:in `call'
  /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:82:in `run_callbacks'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/callbacks.rb:27:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/remote_ip.rb:76:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:38:in `call_app'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:20:in `block in call'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:68:in `block in tagged'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:26:in `tagged'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:68:in `tagged'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:20:in `call'
  /usr/lib/ruby/vendor_ruby/request_store/middleware.rb:8:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/request_id.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/rack/methodoverride.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/rack/runtime.rb:17:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/static.rb:64:in `call'
  /usr/lib/ruby/vendor_ruby/rack/sendfile.rb:112:in `call'
  /usr/lib/ruby/vendor_ruby/rails/engine.rb:514:in `call'
  /usr/lib/ruby/vendor_ruby/rails/application.rb:144:in `call'
  /usr/lib/ruby/vendor_ruby/rails/railtie.rb:194:in `public_send'
  /usr/lib/ruby/vendor_ruby/rails/railtie.rb:194:in `method_missing'
  /usr/lib/ruby/vendor_ruby/rack/urlmap.rb:65:in `block in call'
  /usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `each'
  /usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `call'
  /usr/lib/ruby/vendor_ruby/thin/connection.rb:80:in `block in pre_process'
  /usr/lib/ruby/vendor_ruby/thin/connection.rb:78:in `catch'
  /usr/lib/ruby/vendor_ruby/thin/connection.rb:78:in `pre_process'
  /usr/lib/ruby/vendor_ruby/thin/connection.rb:53:in `process'
  /usr/lib/ruby/vendor_ruby/thin/connection.rb:38:in `receive_data'
  /usr/lib/ruby/vendor_ruby/eventmachine.rb:187:in `run_machine'
  /usr/lib/ruby/vendor_ruby/eventmachine.rb:187:in `run'
  /usr/lib/ruby/vendor_ruby/thin/backends/base.rb:61:in `start'
  /usr/lib/ruby/vendor_ruby/thin/server.rb:159:in `start'
  /usr/lib/ruby/vendor_ruby/thin/controllers/controller.rb:86:in `start'
  /usr/lib/ruby/vendor_ruby/thin/runner.rb:185:in `run_command'
  /usr/lib/ruby/vendor_ruby/thin/runner.rb:151:in `run!'
  /usr/bin/thin:6:in `<main>'
abahgat commented 9 years ago

Hi @onlyjob, 90e54fa8cb55242caa11112cb05a9640352b9eed by @swiatkiewicz and @korin should fix it: would you mind pulling and trying again?

onlyjob commented 9 years ago

Unfortunately I'm unable to test because of new ThinkingSphinx dependency which is not packaged for Debian yet...