```ruby
class ColorSchemaValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value =~ /^#(\h{6}|\h{3})$/
      record.errors.add(attribute, options[:message] || :invalid)
    end
  end
end
```

Fix regexp to more strong
user
```ruby
class ColorSchemaValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value =~ /\A#(\h{6}|\h{3})\z/
      record.errors.add(attribute, options[:message] || :invalid)
    end
  end
end
```
assistant