def create(conn, %{"flux" => flux_params}) do
magnet_ids = flux_params["magnet_id"] || []
case Magnets.create_flux(flux_params, magnet_ids) do
{:ok, flux} ->
conn
|> put_flash(:info, "Flux created successfully.")
|> redirect(to: flux_path(conn, :show, flux))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
end
end






















