ghenry
Programming Phoenix LiveView: assign_demographic issue p179
Hi all,
I’m getting this when going to /survey and all code appears to be the same:
Request: GET /survey
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in PentoWeb.DemographicLive.Form.assign_demographic/1
(pento 0.1.0) lib/pento_web/live/demographic_live/form.ex:16: PentoWeb.DemographicLive.Form.assign_demographic(#Phoenix.LiveView.Socket<assigns: %{__changed__: %{flash: true, id: true, user: true}, flash: %{}, id: "demographic-form", myself: %Phoenix.LiveComponent.CID{cid: 1}, user: #Pento.Accounts.User<__meta__: #Ecto.Schema.Metadata<:loaded, "users">, confirmed_at: nil, email: "ghenry@suretec.co.uk", id: 2, inserted_at: ~N[2022-05-27 09:51:04], updated_at: ~N[2022-05-27 09:51:04], username: "", ...>}, endpoint: PentoWeb.Endpoint, id: "phx-FxEBqzi2O1ybsgYI", parent_pid: nil, root_pid: nil, router: PentoWeb.Router, transport_pid: nil, view: PentoWeb.SurveyLive, ...>)
(pento 0.1.0) lib/pento_web/live/demographic_live/form.ex:11: PentoWeb.DemographicLive.Form.update/2
(phoenix_live_view 0.17.10) lib/phoenix_live_view/utils.ex:394: Phoenix.LiveView.Utils.maybe_call_update!/3
(phoenix_live_view 0.17.10) lib/phoenix_live_view/diff.ex:608: anonymous fn/5 in Phoenix.LiveView.Diff.render_pending_components/6
(elixir 1.13.4) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(stdlib 3.17.2) maps.erl:410: :maps.fold_1/3
Any pointers?
Thanks.
Marked As Solved
ghenry
Found the issue:
Page 181 in the PDF has the code like above, but line 9 should be the key current_user like is shows later in the PDF on page 191 (current_user={@current_user})
Great learning experience though!
Also Liked
SophieDeBenedetto
Author of Programming Phoenix LiveView
Excellent detective work! Thanks so much for catching this and sorry if it sent you down a rabbit hole
I’ll fix this for the next release.
1
Popular Pragmatic Bookshelf topics
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’.
In particula...
New
A Common-Sense Guide to Data Structures and Algorithms, Second Edition by Jay Wengrow @jaywengrow
Hi,
I have the paperback version of t...
New
Hello! Thanks for the great book.
I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
Running mix deps.get in the sensor_hub directory fails with the following error:
** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
“The ProductLive.Index template calls a helper function, live_component/3, that in turn calls on the modal component. ”
Excerpt From: Br...
New
On page 78 the following code appears:
<%= link_to ‘Destroy’, product,
class: ‘hover:underline’,
method: :delete,
data: { confirm...
New
AWDWR 7, page 152, page 153:
Hello everyone,
I’m a little bit lost on the hotwire part. I didn’t fully understand it.
On page 152 @rub...
New
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below:
d...
New
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
From page 13:
On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New
Other popular topics
New
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
New
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting:
asdf install erlang 23.1.2
Configure failed.
checking ...
New
Small essay with thoughts on macOS vs. Linux:
I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
Author Spotlight:
Bruce Tate
@redrapids
Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New
A concise guide to MySQL 9 database administration, covering fundamental concepts, techniques, and best practices.
Neil Smyth
MySQL...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /sublime-text
- /textmate
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /revery
- /ubuntu
- /spring
- /nodejs
- /manjaro
- /diversity
- /lua
- /julia
- /c
- /slackware








