I am trying to render a form with an embedded schema like in the example in the docs:
defmodule User do
schema "users" do
embeds_one :permalink, Permalink
defmodule Permalink do
but the relationship with my embedded schema is
The docs don’t have such an example.
Does anyone know how to render a form in such a case?
embeds_many. The difficulty here is building a UI that’s going to work well for users. The challange here is that you want to manage a collection in a single form - this would normally be a good job for a SPA application.
Yeah, SPA makes sense in this context, but I was wodering if there is a way to do it using LiveView.
ˋinputs_forˋ works for embeds_one just like for embeds_many. It just happens to render one set of fields instead of multiple.
thanks! I think I figured it out - the inputs were not rendered at all, even empty, until I put a default list of structs with nullified fields into the changeset. This part was not clear to me.
I am going to try to implement “add/remove set” buttons with LiveView.
Any success ? If you could nudge me in the right direction, that’ll be quite helpful