]> source.dussan.org Git - redmine.git/commitdiff
Fix RuboCop offense Performance/StringInclude (#37247).
authorGo MAEDA <maeda@farend.jp>
Mon, 6 Feb 2023 13:50:33 +0000 (13:50 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 6 Feb 2023 13:50:33 +0000 (13:50 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22097 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/principal.rb

index 3c350d6a8b875f9cef46599cad816cee74ea86bb..e62b5f320ea9b6472d1894ff94951693d42c52c6 100644 (file)
@@ -179,7 +179,7 @@ class Principal < ActiveRecord::Base
     principal ||= principals.detect {|a| keyword.casecmp(a.login.to_s) == 0}
     principal ||= principals.detect {|a| keyword.casecmp(a.mail.to_s) == 0}
 
-    if principal.nil? && / /.match?(keyword)
+    if principal.nil? && keyword.include?(' ')
       firstname, lastname = *(keyword.split) # "First Last Throwaway"
       principal ||=
         principals.detect do |a|