Use match? instead of =~ when MatchData is not used (#34150).

Patch by Go MAEDA.


git-svn-id: http://svn.redmine.org/redmine/trunk@20168 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-10-23 00:13:38 +00:00
parent 5280861cf3
commit fdba424d77
8 changed files with 18 additions and 18 deletions

View File

@@ -186,7 +186,7 @@ class Setting < ActiveRecord::Base
if settings.key?(:mail_from)
begin
mail_from = Mail::Address.new(settings[:mail_from])
raise unless mail_from.address =~ EmailAddress::EMAIL_REGEXP
raise unless EmailAddress::EMAIL_REGEXP.match?(mail_from.address)
rescue
messages << [:mail_from, l('activerecord.errors.messages.invalid')]
end