From b84f9335c2e0dd012184609fca18e7f04125c5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 22 Feb 2019 06:22:31 +0100 Subject: [PATCH] Quick jump search Dxxxx --- .../hooks/controllers/search_controller_hooks.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb b/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb index 90516b29..b3457383 100644 --- a/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb +++ b/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb @@ -23,13 +23,14 @@ module RedmineDmsf include Redmine::Hook class ControllerSearchHook < RedmineDmsf::Hooks::Listener + include Rails.application.routes.url_helpers def controller_search_quick_jump(context={}) if context.is_a?(Hash) question = context[:question] if question.present? - if question.match(/^D(\d+)$/) && DmsfFile.visible.find_by(id: $1).exists? - return dmsf_file_path(:id => $1) + if question.match(/^D(\d+)$/) && DmsfFile.visible.where(id: $1).exists? + return dmsf_file_path(id: $1) end end end