Hi! I am trying to pass that payment_list list of the new function where I receive it through a different template to the create function through the assign but I can’t do it because it returns a nil
I am doing it as follows:
Here I evolve it from a different template
<form method="get" action = <%=Routes.signer_path(@conn, :new, %{"transaction" => %{"payments_ids" => [1, 2, 3, 4]}})%>>
This is the new one that receives that payment id list and converts it into a payment list, then I save it through assign and then be used in the create function
def new(conn, %{"transaction" => %{"payments_ids" => payments_ids}}) do
payments = select_payment(payments_ids)
conn
|> assign(:payments_list, payments)
|> render("signer.html")
end
and this is the create function that receives that payment list
def create(conn, %{"assets" => assets, "private_key" => private_key}) do
{:ok, transaction} = Accounts.create_transaction(conn.assigns[:payments_list])
IO.inspect(conn.assigns[:payments_list], layaut: "hola")
conn
|> put_flash(:info, " transaction made " <> transaction.id)
|> redirect(to: Routes.payment_list_path(conn, :index))
end
but that conn.assigns [: payments_list], is returning a nil