This is my user_form.html.heex code facing issue is deploying email changeset as emails schema has it’s own changeset
<.simple_form :let={f} for={@changeset} action={@action}>
<.error :if={@changeset.action}>
Oops, something went wrong! Please check the errors below.
</.error>
<.input field={f[:userid]} type="number" label="Userid" />
<.input field={f[:roleid]} type="number" label="Roleid" />
<.input field={f[:managerid]} type="number" label="Managerid" />
<.input field={f[:name]} type="text" label="Name" />
<.input field={f[:emailid]} type="text" label="Emailid" />
<.input field={f[:username]} type="text" label="Username" />
<.input field={f[:password]} type="text" label="Password" />
<%# Email fields %>
<%= for _email_changeset <- @changeset.changes.emails do %>
<%= f.simple_fields_for :emails, fn ef -> %>
<%= ef.input :address, label: "Email Address" %>
<%= ef.input :verified, label: "Verified", as: :boolean %>
<% end %>
<% end %>
<:actions>
<.button>Save User</.button>
</:actions>
</.simple_form>
My changeset look like this
#Ecto.Changeset<
action: nil,
changes: %{
name: "Am Kumar",
password: "Dekh",
userid: 1,
roleid: 0,
managerid: 0,
emailid: "am.kumar@gmail.com",
username: "amkumar",
emails: [
#Ecto.Changeset<
action: :insert,
changes: %{address: "b@apple.com", verified: false},
errors: [],
data: #Pbchat.Accounts.Email<>,
valid?: true
>,
#Ecto.Changeset<
action: :insert,
changes: %{address: "a@apple.com", verified: false},
errors: [],
data: #Pbchat.Accounts.Email<>,
valid?: true
>
]
},
errors: [],
data: #Pbchat.Accounts.User<>,
valid?: true
>