From cc16f72cc7b3c1dc63850fabffa86775db4337f3 Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Fri, 15 Nov 2024 14:51:16 +0000 Subject: [PATCH] refactor(request-type): simplifies morphologies validation --- app/models/request_type.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/request_type.rb b/app/models/request_type.rb index 1a5b2c21af..0f4f59d3c3 100644 --- a/app/models/request_type.rb +++ b/app/models/request_type.rb @@ -82,7 +82,7 @@ class RequestTypePlatePurpose < ApplicationRecord # eg. library_creation has a lower order than sequencing validates :order, presence: true validates :order, numericality: { integer_only: true } - validates :morphology, numericality: { in: 0..2 } # 0..2 is the range of morphologies as defined in ln36-41 + validates :morphology, numericality: { in: 0...MORPHOLOGIES.length } validates :request_class, presence: true, inclusion: { in: ->(_) { [Request, *Request.descendants] } } serialize :request_parameters