Business intelligence made simple
Added email validation
Andrew Kane211e1ee15511
diff --git a/app/models/blazer/check.rb b/app/models/blazer/check.rbindex 6444b6d2..b3103564 100644--- a/app/models/blazer/check.rb+++ b/app/models/blazer/check.rb@@ -4,6 +4,7 @@ module Blazerbelongs_to :queryvalidates :query_id, presence: true+ validate :validate_emailsbefore_validation :set_statebefore_validation :fix_emails@@ -74,5 +75,11 @@ module Blazer# but we know what they mean, so let's fix itself.emails = emails.gsub(";", ",") if emails.present?end++ def validate_emails+ unless split_emails.all? { |e| e =~ /\A.+@.+\..+\z/ }+ errors.add(:base, "Invalid emails")+ end+ endendend