Working with embedded schemas in ecto

Hi all,

I’m working on an application which uses ecto for persisting data. Some of my models have embed_one fields. Inserting new and updating these embedded structs already works, but how to delete only that embedded struct without deleting the enclosing record?

Many thanks!

1 Like

For an embeds_one I believe you’d just set it to nil through a changeset. For embeds_many, I think you have to manually remove the element and set the list back again (just guessing on this one though, hope its not true).

1 Like