summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-09-11 08:08:38 +0000
committerGo MAEDA <maeda@farend.jp>2019-09-11 08:08:38 +0000
commite54f1b23ec996eb39bc57ed3930eec988770a2a2 (patch)
treefa02b3c6872548af5259c37b31ac19eeb92e6ce9 /app/controllers
parenta679b8a5caa3fb0871ea8a10b89d1d44f21e0ea3 (diff)
downloadredmine-e54f1b23ec996eb39bc57ed3930eec988770a2a2.tar.gz
redmine-e54f1b23ec996eb39bc57ed3930eec988770a2a2.zip
Code cleanup: RuboCop: Fix Performance/RedundantMatch and Rails/DynamicFindBy in app/controllers/auto_completes_controller.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18451 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/auto_completes_controller.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb
index e83374c9b..336885349 100644
--- a/app/controllers/auto_completes_controller.rb
+++ b/app/controllers/auto_completes_controller.rb
@@ -30,8 +30,8 @@ class AutoCompletesController < ApplicationController
scope = scope.open(status == 'o') if status.present?
scope = scope.where.not(:id => issue_id.to_i) if issue_id.present?
if q.present?
- if q.match(/\A#?(\d+)\z/)
- issues << scope.find_by_id($1.to_i)
+ if q =~ /\A#?(\d+)\z/
+ issues << scope.find_by(:id => $1.to_i)
end
issues += scope.like(q).order(:id => :desc).limit(10).to_a
issues.compact!