jramnani

jramnani

Programming Phoenix 1.4 book examples updated to 1.7

Hello,

I am almost done going through the book, Programming Phoenix 1.4, again after a hiatus from using Elixir for a few years.

It seems that Phoenix has changed a lot since I last used it around version 1.2, especially the view layer with Phoenix.Component and HEEx templates.

I did my best to get caught up and translated the examples from the book using the new view layer style with components.

You can find my work on GitLab here:

My style is a little different from the authors, but hopefully the examples are close enough to get you unstuck. Please don’t mind the commit messages as I leave breadcrumbs for me to remember things when I come back to this work and refresh my memory.

I am posting here about it, because I thought maybe someone else might be working through the book, and could use some help translating from old to new. I hope folks find this useful, until the book has a chance to be updated.

I hope you’re having a nice day.

Most Liked Switch mode

realcorvus

realcorvus

Thank you for posting this, it’s extremely helpful for people learning Phoenix. Mis-match between the code in the book and the current version is frustrating, great work!

Last Post!

Orzech

Orzech

Replacing

<.input
  field={{f, :category_id}}
  name="category"
  type="select"
  label="Categories"
  prompt="Enter a category"
  options={Enum.map(@categories, fn c -> {c.name, c.id} end)}
  value={Enum.map(@categories, fn c -> c.id end)}
  />

from here with

<.input
  field={f[:category_id]}
  type="select"
  label="Categories"
  prompt="Enter a category"
  options={Enum.map(@categories, fn c -> {c.name, c.id} end)}
  />

is what fixed the problem on Phoenix 1.7.7 for me.

Where Next?

Trending in Other Resources Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement