From e54f1b23ec996eb39bc57ed3930eec988770a2a2 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 11 Sep 2019 08:08:38 +0000 Subject: 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 --- app/controllers/auto_completes_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers') 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! -- cgit v1.2.3