2017-01-01 41 views
0

所以我沿着this wonderful guide以下认可,我已经遇到这个问题似乎没有得到解决。凤凰嵌套的路线不被助手

web/router.ex文件看起来像这样:

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 

,但我得到一个编译错误与undefined function user_post_path/4当我使用助手在模板中。

说的投掷错误的代码行是在模板web/templates/post/edit,这是如下:

<%= render "form.html", changeset: @changeset, action: user_post_path(@conn, :update, @user, @post) %> 

但是,即使我把该行从它在其他模板的问题。

完整的编译错误是:

== 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 

为什么会这样,我怎么能解决这个问题?

+0

我试过让这个指南做回购,但是因为其他原因我不想查看(看起来更难),所以失败了 –

+0

你可以发布引发这个错误和完整的错误信息的行吗? – Dogbert

+0

@Dogbert感谢您的时间;编辑原文 –

回答

-1

我拼写为PostController错误。我是个笨蛋。