0
這裏的相關負責人採取行動:鳳凰應用重定向到一個不同的頁面在生產
def create(conn, %{"post" => post_params}) do
changeset = Post.changeset(%Post{}, post_params)
case Repo.insert(changeset) do
{:ok, _post} ->
conn
|> redirect(to: page_path(conn, :thanks))
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
end
end
在發展 - 這個動作在創建後門柱用戶感謝您網頁重定向。在生產中;但是,它將它們重定向到example.com/posts
而不是example.com/thanks
。
在生產上的頁面顯示如下:
這究竟是爲什麼以及如何解決呢?
在此先感謝。
日誌說什麼? –
如果你被重定向到'/ posts',我懷疑'Repo.insert'返回了'{:error,changeset}',因此你的情況陷入了第二個子句中,它不會「重定向」你,而只是呈現再次創作形式。 雖然,它也顯示了500,但我猜還有其他的東西無法正常工作。 – narrowtux
顯示你的路由器的代碼片斷,':謝謝'這肯定不是REST的路由 - 你有意添加它嗎? – PatNowak