Skip to content

Commit

Permalink
dry run email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Oct 20, 2024
1 parent ab810be commit 9104905
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/params/base_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9104905

Please sign in to comment.