Fix: Added the backend validation for name (#3878)

- Added the backend validation for name
- Add message size constraint
This commit is contained in:
Tejaswini Chile
2022-02-03 03:51:17 +05:30
committed by GitHub
parent e99ea0b582
commit 8821106da9
10 changed files with 83 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ class Contact < ApplicationRecord
validates :phone_number,
allow_blank: true, uniqueness: { scope: [:account_id] },
format: { with: /\+[1-9]\d{1,14}\z/, message: 'should be in e164 format' }
validates :name, length: { maximum: 255 }
belongs_to :account
has_many :conversations, dependent: :destroy_async