Class: ExtendedValidator

Inherits:
ApplicationRecord show all
Defined in:
app/models/extended_validator.rb

Overview

Extended validators are used to provide extra validation of submission. They are associated with request types and will import validation behaviour into submission.

behaviour => the module that will be included in the validator, must respond to validate(submission) options => serialized hash for configuration

Defined Under Namespace

Modules: SpeciesValidator Classes: RequestTypeExtendedValidator

Instance Method Summary collapse

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#import_behaviourObject



22
23
24
25
26
27
# File 'app/models/extended_validator.rb', line 22

def import_behaviour
  return if behaviour.nil?

  behavior_module = "ExtendedValidator::#{behaviour}".constantize
  class_eval { include(behavior_module) }
end