No, the latter code you have (Repo.get_by!(Accounts.Organizations, id: 1) |> Ecto.build_assoc(:applications, name: "My New App") |> Repo.insert!
) is interacting directly with the Repo
/Ecto
interfaces, that’s at a lower level than using your changeset.
To use your changeset you would need to be using cast_assoc
and Handling nested associations with cast_assoc might help you here too.