lib/cocina/models/validatable.rb in cocina-models-0.71.0 vs lib/cocina/models/validatable.rb in cocina-models-0.72.0

- old
+ new

@@ -6,18 +6,18 @@ module Validatable extend ActiveSupport::Concern class_methods do def new(attributes = default_attributes, safe = false, validate = true, &block) - Validator.validate(self, attributes.with_indifferent_access) if validate && name + Validators::Validator.validate(self, attributes.with_indifferent_access) if validate super(attributes, safe, &block) end end def new(*args) validate = args.first.delete(:validate) if args.present? new_model = super(*args) - Validator.validate(new_model.class, new_model.to_h) if (validate || validate.nil?) && self.class.name + Validators::Validator.validate(new_model.class, new_model.to_h) if validate || validate.nil? new_model end end end end