TLDR; If the thing exists, use put_assoc. If you’re creating it, use cast_assoc.
Ecto has two nifty methods for working with associated records in a changeset.
I was working with implementing a closure tree for replies on a comments table the other day and needed a way to represent the “parent” comment for rendering on the front end.