I have the following:
|> put_resp_header("location", author_path(conn, :show, author))
in my AuthorController
.create
function.
I am receiving the following error upon submission of author data to be created:
** (CompileError) lib/library_api_web/controllers/author_controller.ex:16: undefined function author_path/3
My versions are the following:
Erlang/OTP 21 [erts-10.2] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Elixir 1.8.1 (compiled with Erlang/OTP 20)
Phoenix v1.4.4
Windows 10 64bit
Are there changes in Phoenix 1.4.4 that affects the auto-generation of paths like author_path
?
This has been a blocker for me currently @chrismccord
Tried the following:
|> put_resp_header("location", Library.author_path(conn, :show, author))
instead got the following error:
** (UndefinedFunctionError) function LibraryApi.Library.author_path/3 is undefined or private
@ebryn and RyanTablada, is there any venue I could get support for the EmberCasts course I got from you?
Can you try Routes.author_path(conn, :show, author))
?
Are there changes in Phoenix 1.4.4 that affects the auto-generation of paths like author_path
?
Yes, check out your web.ex
, router helpers are not import
ed anymore, but alias
ed as Routes
. This has been this way for quite some time now though, it’s not a particularly new change.
3 Likes
Ah! Thanks so much!. Just started delving into Phoenix and have been following some old tutorials
1 Like