Phoenix: casting multiple checkboxes to {:array, Ecto.Enum}

Glad you think so.
Filtering happens here, before doing the actual casting with Ecto.Type.cast.

Do you think a PR that would instead do a Ecto.Type.reject_empty_values(type, value, empty_values) and use the same kind of dispatching that cast do would be acceptable?

This way, even very complex types like {:array, {:array, Ecto.Enum}} would work (not that I have a use for that :laughing:). I haven’t played with protocols yet, but I imagine that a new callback with a default could be added for custom types?

2 Likes