From 4fbb91dcb92d275940fe7f3a9d945156553f1e3f Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Tue, 7 Feb 2023 00:50:24 +0630 Subject: [PATCH] fix customer validation --- app/models/customer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index a7517292..7e2a7958 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -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