创建与Elixir和Phoenix的帖子链接

时间:2017-12-13 00:32:36

标签: elixir phoenix-framework

我正试图通过链接点击我的问题控制器中的创建操作,但我似乎无法使其正常工作。

LINK:

<%= 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做到这一点吗?

ROUTER:

resources "/questions", QuestionController
get "/build_question", QuestionController, :build_question

ERROR:

lib/statcasters_web/templates/page/index.html.eex:8: undefined function question_path/2

0 个答案:

没有答案