allow email blank at create customer

This commit is contained in:
NyanLinHtut
2022-03-22 11:06:32 +06:30
parent 5ef2e534c5
commit 070dc47225
2 changed files with 8 additions and 8 deletions

View File

@@ -9,9 +9,9 @@ class Customer < ApplicationRecord
has_many :orders
has_many :sales
validates_presence_of :name, :contact_no, :email #,:card_no
validates_presence_of :name, :contact_no #,:card_no
validates :contact_no, numericality: true #uniqueness: true,
# validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
validates :email, presence: true, uniqueness: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }, allow_blank: true
# validates :card_no, uniqueness: true
# validates :paypar_account_no, uniqueness: true