DestyNova

DestyNova

Programming Phoenix LiveView: B0.14 errata, part 2

  • p81: live "/products/new", ProductLive.Index, :new – as you noted just above, the generator in Phoenix 1.8 puts this in ProductLive.Form, not Index

  • p82: What’s going on with the output of mix test here? It looks like old output for Phoenix 1.7 (with fails) is immediately followed by new output for Phoenix 1.8 (with no fails). Perhaps delete the 1.7 output.

  • p82: However, the tests actually fail for me because an exercise on page 72 requests of the reader: If a logged in user visits the / route, make them redirect to the /guess route. – this causes the login tests to fail. Perhaps you could mention this and tell the reader to revert that change.

  • p86: create unique_index(:products, [:sku]) – Phoenix 1.8.1 also added the following line before this: create index(:products, [:user_id])

  • p87: Notice the use Ecto.Schema expression. – that line isn’t included in the code snippet above (although it is in the generated file).

  • p88: We build a struct using the embedded function. – what is meant by “embedded function” here?

  • p90: Product.changeset(product, attrs) – this doesn’t work since, as shown on the previous page, Phoenix 1.8 now generates changeset/3 and expects a user scope as the final argument.

    • I had to do something like this instead: Product.changeset(product, attrs, Scope.for_user(%User{}))
  • p93: Notice that each of them uses/use/uses

  • p97: This code uses the changeset/2 function – It’s changeset/3 now, since the scope param was added.

  • p97: scope = Accounts.get_scope_for_user(user.id) – I can’t find any mention of a get_scope_for_user function anywhere online. Please tell me this section wasn’t generated by ChatGPT?

    • Instead, I had to do this: scope = Pento.Accounts.Scope.for_user(user)

Where Next?

Popular Pragmatic Bookshelf topics Top

brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
leba0495
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
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
jgchristopher
“The ProductLive.Index template calls a helper function, live_component/3, that in turn calls on the modal component. ” Excerpt From: Br...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
taguniversalmachine
It seems the second code snippet is missing the code to set the current_user: current_user: Accounts.get_user_by_session_token(session["...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

PragmaticBookshelf
Write Elixir tests that you can be proud of. Dive into Elixir’s test philosophy and gain mastery over the terminology and concepts that u...
New
Exadra37
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
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
PragmaticBookshelf
Develop, deploy, and debug BEAM applications using BEAMOps: a new paradigm that focuses on scalability, fault tolerance, and owning each ...
New
NewsBot
Node.js v22.14.0 has been released. Link: Release 2025-02-11, Version 22.14.0 'Jod' (LTS), @aduh95 · nodejs/node · GitHub
New

Sub Categories: