jramnani

jramnani

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.

Showing Posts 1 to 3

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!

Orzech

Orzech

Thanks for posting this, @jramnani!

Does category input select in lib/rumbl_web/controllers/video_html/video_form.html.heex work fine for you?

When I use your code as is, the select neither has the proper value selected when opening edit video page, nor the changeset contains changed category_id when I save updated video.

When I use value={f.data.category_id}, the form has category value properly selected when opening edit video page, but still the changeset does not contain changed category_id when I save updated video.

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.

— All posts loaded —

Where Next? Top

Trending in Other Resources Top

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
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
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews