Please, could you help me refine this Ecto changeset manipulation function?

I think you could clean this up a bit using get_field/3.

While get_change/3 only looks at the current changes to retrieve a value, this function looks at the changes and then falls back on the data, finally returning default if no value is available.

https://hexdocs.pm/ecto/Ecto.Changeset.html#get_field/3

1 Like