Add new model presence validates
- Only validate :date_of_birth and :postal_code presence when the application has configured Remote Census and their alias fields has values.
This commit is contained in:
@@ -5,6 +5,8 @@ class Verification::Management::Document
|
||||
attr_accessor :document_type, :document_number, :date_of_birth, :postal_code
|
||||
|
||||
validates :document_type, :document_number, presence: true
|
||||
validates :date_of_birth, presence: true, if: -> { Setting.force_presence_date_of_birth? }
|
||||
validates :postal_code, presence: true, if: -> { Setting.force_presence_postal_code? }
|
||||
|
||||
delegate :username, :email, to: :user, allow_nil: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user