class GoldenFleece::Validations::ActiveModel::FleeceSchemaConformanceValidator

Public Instance Methods

validate_each(record, attribute, persisted_json) click to toggle source
# File lib/golden_fleece/validations/active_model/fleece_schema_conformance_validator.rb, line 8
def validate_each(record, attribute, persisted_json)
  context = record.class.fleece_context
  errors = ValidatorContext.new(record, attribute, persisted_json, context.schemas[attribute], '/').validate

  errors.each { |e| record.errors.add attribute, e }
  errors.empty?
end