I currently make it thru “Programming Phoenix” from pragprog.com. I’m as far that i have a controller (UserController) with the functions index, new and show. Index and show work perfectly fine but for the new function i get the error:
# Could not render "new.html" for RumbleWeb.UserView, please define a matching clause for render/2 or define a template at "lib/rumble_web/templates/user". The following templates were compiled:
* index.html
* show.html
The file new.html.eex exists. I have checked my code against the book several times and could not find out why the html template under templates/user/new.html.eex can not be compiled. I tried to remove the code in new.html.eex to a simple string but did not help either.
defmodule RumblWeb.UserController do
use RumblWeb, :controller
alias Rumbl.Accounts
def index(conn, _params) do
users = Accounts.list_users()
render(conn, "index.html", users: users)
end
def show(conn, %{"id" => id}) do
user = Accounts.get_user(id)
render(conn, "show.html", user: user)
end
def testing(conn, %{"id" => id}) do
user = Accounts.get_user(id)
render(conn, "testing.html", user: user)
end
end
That is my controller, the view exists. It is rendering index.html.heex but failed to render any other view in the same user templates dir.