fix customer validation

This commit is contained in:
NyanLinHtut
2023-02-07 00:50:24 +06:30
parent d004b8bcde
commit 4fbb91dcb9

View File

@@ -9,8 +9,8 @@ class Customer < ApplicationRecord
has_many :orders
has_many :sales
validates_presence_of :name, :contact_no #,:card_no
validates :contact_no, numericality: true #uniqueness: true,
validates_presence_of :name #, :contact_no #,:card_no
validates :contact_no, numericality: true, uniqueness: { scope: :shop_code }, allow_blank: true
validates :email, presence: true, uniqueness: { scope: :shop_code }, 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