
belgoros
Programming Phoenix LiveView B10: wrong arguments number in RatingLive.Show.stars (page 220)
In PentoWeb.RatingLive.Index.product_rating/1
function, there is a call to <RatingLive.Show.stars rating={rating} product={@product} />
. Later on, the function is referenced as having the only argument:
with the yet-to- be-built Show.stars/1 component…
what is in line with the defined later function:
defmodule PentoWeb.RatingLive.Show do
use Phoenix.Component
use Phoenix.HTML
attr :rating, :any, required: true
def stars(assigns) do
~H"""
<div>
<%= @rating.stars
|> filled_stars()
|> Enum.concat(unfilled_stars(@rating.stars))
|> Enum.join(" ")
|> raw() %>
</div>
"""
end
...
VS Code even displays a warning about it.
Later, on page 224, the call is correct though:
<Show.stars rating={rating} />
One more point regarding defining an alias for alias PentoWeb.RatingLive.Show
on page 224:
Make sure to alias the module in survey_live.ex like this
PentoWeb.RatingLive.
First, the name of the module is not wrong (survey_live.ex
) and should rather be RatingLive.Index
. In this case, as alias PentoWeb.RatingLive
being already aliased (defined on page 218), the correct module to be aliased would be alias PentoWeb.RatingLive.Show
, and alias PentoWeb.RatingLive
should be removed.
Marked As Solved

SophieDeBenedetto
Right you are on both counts! This will be fixed in the final release.
Popular Pragmatic Bookshelf topics









Modern front-end development for Rails, second edition - Struggling to get the first chapter to work

Other popular topics










Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /rails
- /python
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /crystal
- /c-plus-plus
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /sublime-text
- /lisp
- /textmate
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /ubuntu
- /revery
- /manjaro
- /spring
- /nodejs
- /diversity
- /deno
- /lua
- /julia
- /slackware
- /c