Reputation: 3216
So I'm following along this wonderful guide and I've come across this issue that does not seem to be addressed.
My web/router.ex
file looks like this:
defmodule Pxblog.Router do
use Pxblog.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", Pxblog do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
resources "/users", UserController do
resources "/posts", PostConroller
end
resources "/sessions", SessionController, only: [:new, :create, :delete]
end
# Other scopes may use custom stacks.
# scope "/api", Pxblog do
# pipe_through :api
# end
end
but I'm getting a compilation error with undefined function user_post_path/4
when I use the helper in a template.
The line that's throwing the error is in the template web/templates/post/edit
, and it's as follows:
<%= render "form.html", changeset: @changeset, action: user_post_path(@conn, :update, @user, @post) %>
But it's an issue in other templates even when I take that line out.
The full compilation error is:
== Compilation error on file web/views/post_view.ex
==
** (CompileError) web/templates/post/edit.html.eex:
4: undefined function user_post_path/4
(stdlib) lists.erl:1338: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:117: a
nonymous fn/4 in Kernel.ParallelCompiler.spawn_comp
ilers/1
Why is this happening, and how can I fix it?
Upvotes: 0
Views: 602