Hello, I’m going to create a form in phoenix 1.4, but I have a Helpers error.
my form in my template:
<%= form_for @changeset, admin_dashbord_path(@conn, :cards_category_edit), fn f -> %>
when I use that code I will have this error:
lib/wedding_card_web/templates/admin_dashbord/card-category-edit.html.eex:20: undefined function admin_dashbord_path/2
if I add a Helpers.
to admin_dashbord_path
, I will have this error:
** (UndefinedFunctionError) function Helpers.admin_dashbord_path/2 is undefined (module Helpers is not available)
how can I fix this ?
my router:
scope "/card-admin", WeddingCardWeb do
pipe_through :browser
get "/", AdminDashbordController, :index
get "/card/category/edit-load", AdminDashbordController, :cards_category_edit_load
post "/card/category/edit", AdminDashbordController, :cards_category_edit
end
my Controller:
defmodule WeddingCardWeb.AdminDashbordController do
use WeddingCardWeb, :controller
alias WeddingCard.DB.CardCategoryQuery
def index(conn, _params) do
render(conn, "index.html")
end
# card functions
def cards_category_edit_load(conn, %{"id" => id}) do
changeset = CardCategoryQuery.get_category_by_id(id).description
render(conn, "card-category-edit.html", changeset: changeset)
end
def cards_category_edit(conn, _params) do
render(conn, "card-category-edit.html")
end
end