From 96ccb09908912f4786a24147e30cf39a8f028389 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Tue, 21 Jun 2022 20:01:20 +0200 Subject: [PATCH] screen_name_validator: use non-deprecated syntax for adding errors to fields --- app/validators/screen_name_validator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/validators/screen_name_validator.rb b/app/validators/screen_name_validator.rb index 8d462e2a..815d4faa 100644 --- a/app/validators/screen_name_validator.rb +++ b/app/validators/screen_name_validator.rb @@ -8,7 +8,7 @@ class ScreenNameValidator < ActiveModel::EachValidator FORBIDDEN_SCREEN_NAME_REGEXPS = [/wreciap\z/i].freeze def validate_each(record, attribute, value) - record.errors[attribute] << "Thou shalt not use this username! Please choose another one." if FORBIDDEN_SCREEN_NAMES.include? value.downcase - record.errors[attribute] << "Registration is tempoarily disabled for new users." if FORBIDDEN_SCREEN_NAME_REGEXPS.any? { |regexp| value.downcase =~ regexp } + record.errors.add(attribute, message: "Thou shalt not use this username! Please choose another one.") if FORBIDDEN_SCREEN_NAMES.include?(value.downcase) + record.errors.add(attribute, message: "Registration is tempoarily disabled for new users.") if FORBIDDEN_SCREEN_NAME_REGEXPS.any? { |regexp| value.downcase =~ regexp } end end