Thanks I have been trying that path but so far I have not got the correct syntax or perhaps I am not preloading in the right section of the code. I know the user iID but since the comment is not yet inserted in the database is it enough to just preload the User record data so it is encoded prior to the build_assoc? IOW?
user_id = socket.assigns.user_id
changeset = topic
|> Repo.get(user_id)
|> Repo.preload(comments: [:user])
|> build_assoc(:comments, user_id: user_id)
|> Comment.changeset(%{content: content})
Not sure if can just insert a |> Repo.get(…) into a pipeline designed to from a changeset?






















