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

New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
Mmm
Hi, build fails on: bracket-lib = “~0.8.1” when running on Mac Mini M1 Rust version 1.5.0: Compiling winit v0.22.2 error[E0308]: mi...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
dachristenson
@mfazio23 Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
PragmaticBookshelf
Brace yourself for a fun challenge: build a photorealistic 3D renderer from scratch! In just a couple of weeks, build a ray tracer that r...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
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
From finance to artificial intelligence, genetic algorithms are a powerful tool with a wide array of applications. But you don't need an ...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
PragmaticBookshelf
Programming Ruby is the most complete book on Ruby, covering both the language itself and the standard library as well as commonly used t...
New
RobertRichards
Hair Salon Games for Girls Fun Girls Hair Saloon game is mainly developed for kids. This game allows users to select virtual avatars to ...
New

Sub Categories: