class ContentfulLite::Validations::IncludedAssetValidator
@api private
Public Instance Methods
validate_child(record, attr_name, value, idx = nil)
click to toggle source
# 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 #{options[:type]}") if options[:type] && !value&.content_type&.include?(options[:type].to_s) end