mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
Update Customer model to validate email with valid_email2 gem
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user