2017-01-01 38 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錯誤。我是個笨蛋。