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
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
cro
I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
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
davetron5000
Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
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
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
roadbike
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
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
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
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
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
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
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Use WebRTC to build web applications that stream media and data in real time directly from one user to another, all in the browser. ...
New
New
PragmaticBookshelf
Explore the power of Ash Framework by modeling and building the domain for a real-world web application. Rebecca Le @sevenseacat and ...
New

Sub Categories: