Just came across this issue where with nested associations Ecto actually nests changesets within each other, storing them against the association name. Calling the errors key on the struct is only going to give us the errors on the primary changeset, or in our case the User and not traverse the nested changeset for the Address.
%Ecto.Changeset{action: nil,
changes: %{address: %Ecto.Changeset{action: :insert,
changes: %{address1: “123 Main St”, city: “New York”}, constraints:[],
errors: [country: “can’t be blank”], filters: %{},
model: %UserAddress.Address{}}
Because of this Phoenix fails to show the errors on the forms properly with error_tags.
Is the only solution to this is traverse_errors/2
?