I have a toy project I'm using to help me learn Elixir/Phoenix.
I'm importing some data from a csv and I want to insert those records into the database if they are valid according to my changeset.
The question I have is that sometimes one of the columns that normally contains an integer will have "n/a". This causes the changeset to be invalid, as it should.
I'm not sure what the Elixir standard way to handle this is.
In these cases I just want the "n/a" to be converted to 0.
Would you normally write a custom type for this that does that conversion?
https://hexdocs.pm/ecto/Ecto.Type.html
In Rails I might solve this on the model using a custom setter or in a before_save or something.