Sfoglia il codice sorgente

Sub ; with , for check emails

Andrew Kane 8 anni fa
parent
commit
25194f8f7b
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      app/models/blazer/check.rb

+ 7 - 0
app/models/blazer/check.rb

@@ -6,6 +6,7 @@ module Blazer
     validates :query_id, presence: true
 
     before_validation :set_state
+    before_validation :fix_emails
 
     def set_state
       self.state ||= "new"
@@ -15,6 +16,12 @@ module Blazer
       emails.to_s.downcase.split(",").map(&:strip)
     end
 
+    def fix_emails
+      # some people like doing ; instead of ,
+      # but we know what they mean, so let's fix it
+      self.emails = emails.gsub(";", ",") if emails.present?
+    end
+
     def update_state(result)
       check_type =
         if respond_to?(:check_type)