Hi ,
I hvae just started learning phoenix and I’m following the “Programming Phoenix” book . I have some problems with the user example (chapter 3). I have created a Rumbl.UserView but accidently named it USerView. When I’ve caught the problem I’ve changed it but the mopdule was already loaded as Rumbl.USer. I’ve compiled the user_view.ex manually and that got me the correct module loaded. This is the first question: Isn’t supposed to see the change and recompile it when I start the server?
Going further the mix phoenix.server doesn’t start as it gets the following error:
Compilation error in file web/views/user_view.ex ==
** (SyntaxError) web/templates/user/show.html.eex:3: unexpected token: “” (column 1, codepoint U+200B)
(eex) lib/eex/compiler.ex:37: EEx.Compiler.generate_buffer/4
(phoenix) lib/phoenix/template.ex:378: Phoenix.Template.compile/2
(phoenix) lib/phoenix/template.ex:186: anonymous fn/3 in Phoenix.Template.“MACRO-before_compile”/2
(elixir) lib/enum.ex:1826: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix) expanding macro: Phoenix.Template.before_compile/1
web/views/user_view.ex:1: Rumbl.UserView (module)
(elixir) lib/kernel/parallel_compiler.ex:121: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
If I use iex -S mix and fire
view = Rumbl.UserView.render(“user.html”, user: user)
{:safe, [[[[["" | “”] | “jose”] | " ("] | “1”] | “)”]}
Everything looks fine.
THe user.html is used in show.html to render a user.
The code for the template is:
show.html.eex:
Showing user
<%= render "user.html", user: @user %>
iex:
view = Rumbl.UserView.render(“show.html”, user: user)
{:safe, ["" | “
Showing user
\n\n\n”]}I’ve deleted the _build folder, i’ve mix clean, mix compile. No success.
My env: elixir 1.5.2, Phoenix 1.2.5, OTP 2.1. Using Visual studio code.
Any help is appreciated.
Thank you