mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-30 12:19:38 +00:00
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
This commit is contained in:
parent
a679b8a5ca
commit
e54f1b23ec
@ -817,7 +817,6 @@ Performance/RedundantBlockCall:
|
||||
# Cop supports --auto-correct.
|
||||
Performance/RedundantMatch:
|
||||
Exclude:
|
||||
- 'app/controllers/auto_completes_controller.rb'
|
||||
- 'app/models/issue_relation.rb'
|
||||
- 'lib/redmine/wiki_formatting/textile/formatter.rb'
|
||||
- 'lib/redmine/wiki_formatting/textile/redcloth3.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!
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user