From 070dc4722510a11646cc9c4bb2214ff47482f86d Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Tue, 22 Mar 2022 11:06:32 +0630 Subject: [PATCH] allow email blank at create customer --- app/models/customer.rb | 4 ++-- app/models/printer/printer_worker.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index dfbb8500..5422acac 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -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 diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index d30af42d..48fab952 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -48,11 +48,11 @@ class Printer::PrinterWorker copy = self.print_copies #Print only when printer information is not null - if !self.printer_destination.nil? - (1..copy).each do - page = Cups::PrintJob.new(file_path, printer_destination) - page.print - end - end + # if !self.printer_destination.nil? + # (1..copy).each do + # page = Cups::PrintJob.new(file_path, printer_destination) + # page.print + # end + # end end end