From 910490528deeeab1c95c4c6c7753be41d3590356 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 20 Oct 2024 15:44:24 +0300 Subject: [PATCH] dry run email validation --- lib/params/base_validator.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/params/base_validator.rb b/lib/params/base_validator.rb index c394519aa..4c2571e84 100644 --- a/lib/params/base_validator.rb +++ b/lib/params/base_validator.rb @@ -72,7 +72,11 @@ def email_format(params, key, message: nil) return if params[key].blank? return if params[key].to_s.strip.split(/\s*[;,]\s*/).all? { |email| email.match?(EMAIL_REGEXP) } - raise_error(message || "#{key} must follow the email format") + if Rails.env.production? + Rollbar.error(message || "#{key} must follow the email format") if defined?(Rollbar) + else + raise_error(message || "#{key} must follow the email format") + end end def unique_value(params, key, message: nil)