Validate contact and invoice emails when they change #2745

This commit is contained in:
Priit Tark 2015-08-06 13:21:15 +03:00
parent c482a3e46d
commit 6ca53f946a
7 changed files with 43 additions and 2 deletions

View file

@ -12,7 +12,7 @@ class Invoice < ActiveRecord::Base
}
attr_accessor :billing_email
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }, allow_blank: true
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
validates :invoice_type, :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true