Class: ContentfulLite::Validations::IncludedAssetValidator Private
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ContentfulLite::Validations::IncludedAssetValidator
- Includes:
- IncludedChildValidator
- Defined in:
- lib/contentful_lite/validations/included_asset_validator.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants included from IncludedChildValidator
ContentfulLite::Validations::IncludedChildValidator::BASE_OPTIONS
Instance Method Summary collapse
Methods included from IncludedChildValidator
Instance Method Details
#validate_child(record, attr_name, value, idx = nil) ⇒ 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 |
# File 'lib/contentful_lite/validations/included_asset_validator.rb', line 8 def validate_child(record, attr_name, value, idx = nil) record_error(record, attr_name, "value#{idx} is not a published asset") && return unless value.is_a?(ContentfulLite::Asset) record_error(record, attr_name, "value#{idx} has an invalid asset type. Expecting #{[:type]}") if [:type] && !value&.content_type&.include?([:type].to_s) end |