我正试图通过链接点击我的问题控制器中的创建操作,但我似乎无法使其正常工作。
<%= link "Create question", to: question_path(@conn, :create), method: :post %>
defmodule StatcastersWeb.QuestionController do
import Ecto.Query
use StatcastersWeb, :controller
alias Statcasters.{League, Repo, UsersLeagues, SportRadar}
require IEx
def create(conn, _params) do
IEx.pry
games = Nba.get_todays_games
end
end
你知道我如何用Elixir和Phoenix做到这一点吗?
resources "/questions", QuestionController
get "/build_question", QuestionController, :build_question
lib/statcasters_web/templates/page/index.html.eex:8: undefined function question_path/2