Good Morning,
I’m running into an odd issue using validate_length in my changesets, where it doesn’t seem to error on a string less than 3 characters. Testing all of the following:
validate_length(:field, min: 1, max: 1)
validate_length(:field, max: 1)
validate_length(:field, is: 1)
as well as using count: :graphemes
or count: :codepoints
will net the following results:
field: "G"
- No error (correct)
field: "GR"
- No error (not correct)
field: "GRE"
- Error (correct)
I can’t seem to find anything in source or the docs that suggests validate_length doesn’t work on strings less than 3 characters in length, or even an existing issue related to this.
I just wanted to put it out here and see if anyone else had the issue before I prop up a git repo and submit an issue with Ecto.