class ActiveModel::EachValidator

def validate_each(record, attribute, value)

errors to the records +errors+ array where necessary.
Override this method in subclasses with the validation logic, adding
def validate_each(record, attribute, value)
  raise NotImplementedError, "Subclasses must implement a validate_each(record, attribute, value) method"
end