From 88dbd595888e33e0892e10968d6675368e2073bb Mon Sep 17 00:00:00 2001 From: Matthew Phelan Date: Fri, 8 Oct 2021 14:38:49 +0100 Subject: [PATCH] base to question type --- app/models/case_log.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index cbe687701..13c7a2f7a 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -3,9 +3,9 @@ class CaseLogValidator < ActiveModel::Validator def validate_tenant_age(record, validation_regex) regexp = Regexp.new validation_regex if !record.tenant_age? - record.errors.add :base, "Tenant age can't be blank" + record.errors.add :tenant_age, "Tenant age can't be blank" elsif !(record.tenant_age.to_s =~ regexp) - record.errors.add :base, "Tenant age must be between 0 and 100" + record.errors.add :tenant_age, "Tenant age must be between 0 and 100" end end @@ -14,7 +14,7 @@ class CaseLogValidator < ActiveModel::Validator validation_regex = options[:validation] if question_to_validate == "tenant_code" if !record.tenant_code? - record.errors.add :base, "Tenant code can't be blank" + record.errors.add :tenant_code, "Tenant code can't be blank" end elsif question_to_validate == "tenant_age" validate_tenant_age(record, validation_regex)