Hi guys,
I ran into an issue with elixirs Range not being handled properly.
This snippet from my changeset
|> validate_inclusion(:value, 6..20)
produces this error message when the condition is not met (shortened as it just goes on stating a ton of types)
** (Protocol.UndefinedError) protocol String.Chars not implemented for 6..20 of type Range (a struct). This protocol is implemented for the following type(s): Postgrex.Copy, [...], DateTime
I played around a bit and it seems like changing the interpolated_value_to_string/1 function to use inspect/1 rather than to_string fixes the issue. I'm not sure what the exact difference in behaviour is and if this might break people's code, but if you guys are interested I'm happy to open a PR for this.
I'm on 1.1.2 with elixir 1.9.4 and OTP 22 if that makes any difference
Hi guys,
I ran into an issue with elixirs
Rangenot being handled properly.This snippet from my changeset
produces this error message when the condition is not met (shortened as it just goes on stating a ton of types)
I played around a bit and it seems like changing the
interpolated_value_to_string/1function to useinspect/1rather thanto_stringfixes the issue. I'm not sure what the exact difference in behaviour is and if this might break people's code, but if you guys are interested I'm happy to open a PR for this.I'm on 1.1.2 with elixir 1.9.4 and OTP 22 if that makes any difference