Enum.member? on Ecto.Changeset

I would like to perform the following,

Let’s say,

child = Ecto.Changeset


child.errors = [parent_id: "unavailable", [validation: :required]}]

I want to perform something like this,

Enum.member?(child.errors, [parent_id: "unavailable", [validation: :required]}])

Basically, I am trying to check if the error returned matches the expected error. Any insights on this appreciated. Thanks in advance!


Please show your solution for others to learn also. :slight_smile:

1 Like