Module: ContentfulLite::Validations::IncludedChildValidator Private

Extended by:
ActiveSupport::Concern
Included in:
IncludedAssetValidator, IncludedEntryValidator
Defined in:
lib/contentful_lite/validations/included_child_validator.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

BASE_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[allow_blank array].freeze

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr_name, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
# File 'lib/contentful_lite/validations/included_child_validator.rb', line 8

def validate_each(record, attr_name, value)
  if value.blank?
    record_error(record, attr_name, "value is blank") unless options[:allow_blank]
  elsif options[:array]
    validate_array(record, attr_name, value)
  else
    validate_child(record, attr_name, value)
  end
end