wolfiton
Programming phoenix Chapter 3. Controllers page 54
Hi everyone,
Problem in programming phoenix page 55
Error trace:
[info] GET /users/
[debug] Processing with RumblWeb.UserController.index/2
Parameters: %{}
Pipelines: [:browser]
[info] Sent 500 in 53ms
[error] #PID<0.435.0> running RumblWeb.Endpoint (connection #PID<0.434.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /users/
** (exit) an exception was raised:
** (ArgumentError) assign @user not available in eex template.
Please make sure all proper assigns have been set. If this
is a child template, ensure assigns are given explicitly by
the parent template as they are not automatically forwarded.
Available assigns: [:conn, :users, :view_module, :view_template]
(phoenix_html) lib/phoenix_html/engine.ex:133: Phoenix.HTML.Engine.fetch_assign!/2
(rumbl) lib/rumbl_web/templates/user/index.html.eex:2: RumblWeb.UserView."index.html"/1
(rumbl) lib/rumbl_web/templates/layout/app.html.eex:26: RumblWeb.LayoutView."app.html"/1
(phoenix) lib/phoenix/view.ex:410: Phoenix.View.render_to_iodata/3
(phoenix) lib/phoenix/controller.ex:729: Phoenix.Controller.__put_render__/5
(phoenix) lib/phoenix/controller.ex:746: Phoenix.Controller.instrument_render_and_send/4
(rumbl) lib/rumbl_web/controllers/user_controller.ex:1: RumblWeb.UserController.action/2
(rumbl) lib/rumbl_web/controllers/user_controller.ex:1: RumblWeb.UserController.phoenix_controller_pipeline/2
(phoenix) lib/phoenix/router.ex:288: Phoenix.Router.__call__/2
(rumbl) lib/rumbl_web/endpoint.ex:1: RumblWeb.Endpoint.plug_builder_call/2
(rumbl) lib/plug/debugger.ex:122: RumblWeb.Endpoint."call (overridable 3)"/2
(rumbl) lib/rumbl_web/endpoint.ex:1: RumblWeb.Endpoint.call/2
(phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4
(cowboy) /home/dan/Codes/rumbl/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
(cowboy) /home/dan/Codes/rumbl/deps/cowboy/src/cowboy_stream_h.erl:320: :cowboy_stream_h.execute/3
(cowboy) /home/dan/Codes/rumbl/deps/cowboy/src/cowboy_stream_h.erl:302: :cowboy_stream_h.request_process/3
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
I know that this errors tell me that I don’t have assigned to the template the value of user but i did using this:
Content from :user/index.html.eex
<tr>
<td><%= render("user.html", user: @user) %></td>
<td><%= link "View", to: Routes.user_path(@conn, :show, @user.id) %></td>
</tr>
Content from :user/show.html.eex
<h1>Showing User</h1>
<%= render "user.html", user: @user %>
Content from: user/user.html.eex
<strong><%= first_name(@user) %></strong> (<%= @user.id %>)
So why does phoenix tell me that i haven’t assigned user in the template?
Thanks in advance
Most Liked
NobbZ
:users is not @user, your index.html.eex is wrong.
1
NobbZ
And we are back to singular vs plural.
1
Popular in Chat/Questions
What are the best beginner resources for learning Elixir and OTP (not Phoenix) in 2018?
New
Long story short, I have a real world need to create a view for hooking up a shipping terminal to live data, but because of some early ar...
New
Hi,i’m new to elixir.
i’m searching elixir small programs to try it out my self,Is any good resources out there?
Thank you.
New
Anybody knows any tutorial on how to create a blog in Phoenix?
New
and what resources you used to learn Elixir?
New
Hey, I want to learn Elixir OTP and I wanted to know if there are any good resources that teach it. I found some web pages, but none of t...
New
Background
I am trying to recycle myself and improve my knowledge about Phoenix. With 1.7 now out, this seems like a good opportunity.
W...
New
I've been trying to start learning Elixir for a couple of weeks while I develop a tiny project I have on node.js, but every time I try to...
New
Hey, I have very restricted resources and time so I’m trying to understand the best way to learn Liveview in terms of cost/time.
The Pra...
New
Hi Team
From the title, I am entirely new to programming and i am interested in learning elixir but not sure where to start. Can someone...
New
Other popular topics
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New








