```ruby
class DomainValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors.add attribute, :not_valid_format if value.split('.').length < 2
  end
end
```

Cover empty value scenario in DomainValidator
user
```ruby
class DomainValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors.add attribute, :not_valid_format if value.present? && value.split('.').length < 2
  end
end
```
assistant