Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranges are not handled #16

Open
tonnenpinguin opened this issue May 14, 2020 · 0 comments
Open

Ranges are not handled #16

tonnenpinguin opened this issue May 14, 2020 · 0 comments

Comments

@tonnenpinguin
Copy link

tonnenpinguin commented May 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant