please i would like to understand how to implement cast_assoc form for has many relationship using inputs_for for the nested relationship but currently only working for has_one and not implementing for has_many relatiosnhip, when it comes to has many only the main field showing not the associated field:
This is the html aspect of my code:
<%= form_for @payment_changeset, "#", [phx_submit: :create_payment, phx_change: :validate_payment_entry, phx_target: @myself, id: "capture_account_info"], fn f -> %>
<div class="border border-gray-300 rounded-lg p-6 bg-white shadow-md">
<div class="manual-entry-css">
<div class="flex md:flex-row flex-col items-center justify-between gap-4">
<%= inputs_for f, :beneficiaries, fn b_changeset -> %>
<div class="py-3">
<%= select(
b_changeset,
:bank_id,
Enum.map(@bank_names, &{&1.bank_name, &1.id}),
required: true,
class: "focus:outline-0 px-4 py-2 rounded-l-md w-full border form-control",
phx_update: :ignore
) %>
<%= hidden_input(b_changeset, :bank_location, value: "local") %>
</div>
<div class="py-3">
<%= text_input(b_changeset, :account_number,
required: true,
class: "w-full form-control",
placeholder: " Account Number"
) %>
<p class="block ">
<%= error_tag(b_changeset, :account_number) %>
</p>
</div>
<% end %>
<div class="py-3">
<%= text_input(
f,
:balance,
class: "w-full form-control",
placeholder: "Amount",
required: true
) %>
</div>
</div>
</div>
<div class="flex items-end justify-end lg:mt-2 mt-4">
<button phx-target={@myself} type="submit" class="btn-primary rounded-sm">
Add
</button>
</div>
</div>
<% end %>
</div>
<% end %>
please i need help with fixing this problem