From db88121ed8ab76b15bbb5c4b289dfa04230a05cf Mon Sep 17 00:00:00 2001 From: Nihal Mohammed Date: Tue, 6 Jul 2021 18:00:58 +0530 Subject: [PATCH] Update Customer model to validate email with valid_email2 gem --- Gemfile.lock | 5 +++-- app/models/customer.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 100c032905..e19885d3a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -647,8 +647,9 @@ GEM valid_email2 (4.0.0) activemodel (>= 3.2) mail (~> 2.5) - view_component (2.34.0) - activesupport (>= 5.0.0, < 7.0) + view_component (2.35.0) + activesupport (>= 5.0.0, < 8.0) + method_source (~> 1.0) view_component_storybook (0.8.0) view_component (>= 2.2) warden (1.2.9) diff --git a/app/models/customer.rb b/app/models/customer.rb index 9d38bc7427..43bc2cf9e8 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -20,7 +20,7 @@ class Customer < ApplicationRecord before_validation :empty_code validates :code, uniqueness: { scope: :enterprise_id, allow_nil: true } - validates :email, presence: true, + validates :email, presence: true, 'valid_email_2/email': true, uniqueness: { scope: :enterprise_id, message: I18n.t('validation_msg_is_associated_with_an_exising_customer') } validates :enterprise, presence: true