Skip to content

Instantly share code, notes, and snippets.

@dzfranklin
Created July 18, 2021 18:50
Show Gist options
  • Save dzfranklin/d4057ccb2a75fa21f389069af78f3401 to your computer and use it in GitHub Desktop.
Save dzfranklin/d4057ccb2a75fa21f389069af78f3401 to your computer and use it in GitHub Desktop.
defp clear_record_id_error(changeset) do
errors =
changeset.errors
|> Enum.filter(fn
{:record_id, _} -> false
_ -> true
end)
if Enum.empty?(errors) do
%{changeset | errors: [], valid?: true}
else
%{changeset | errors: errors}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment