I’m struggling here on how to get a field value from a changeset.
First I had this very easy oneliner: changeset.changes[:email] || changeset.data[:email]
.
Then, I realized this was wrong and what I really wanted was something like:
case changeset do
%Ecto.Changeset{changes: %{email: email}} -> email
_ -> changeset.data[:email]
end
So, is there an ecto function that gets this correctly it for me?
Thanks