class ActiveModel::Validations::SlugValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/active_validators/active_model/validations/slug_validator.rb, line 4
def validate_each(record, attribute, value)
  if value.nil?
    record.errors.add(attribute, :blank)
  elsif value != value.parameterize
    record.errors.add(attribute)
  end
end