Тёмный

Phoenix forms without changesets! 

German Velasco
Подписаться 1,5 тыс.
Просмотров 2,1 тыс.
50% 1

Typically, we back Phoenix forms with an Ecto changeset.
But sometimes, I prefer having more of a separation between the form, which is part of my UI, and the changeset that stores data in the database.
Check out how we can use `to_form/2` to back our forms with a map!
For more videos like this, check out elixirstreams.com

Наука

Опубликовано:

 

8 авг 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@carlheinz.conradie
@carlheinz.conradie 10 месяцев назад
Thank you for taking the time and making these.
@germanvelasco
@germanvelasco 10 месяцев назад
Glad you like them! 🥳
@ElixirClubDEV
@ElixirClubDEV 10 месяцев назад
Pretty cool, may be a full tutorial would be even cooler!
@luisfeliperodrigues7831
@luisfeliperodrigues7831 4 месяца назад
how can i use to_form with a form thats not use
@devarloop1981
@devarloop1981 2 месяца назад
Hello, you have to implement manually what .from .input does. Checkout core_components to understand how that works. Wope it worked!
@andreasaba4566
@andreasaba4566 6 месяцев назад
can you please share with us the source code of a simple blog? i'm trying to learn how to deal with phoenix building a blog but i have to much difficulties in the process . I'm new to the programming world as same as phoenix/elixir and i can't find anything updated with the new liveview practices. Thanks for your work :D
@germanvelasco
@germanvelasco 6 месяцев назад
In regards to blogs, I don't currently use Phoenix (or even Elixir) for that. My blog currently uses Jekyll (Ruby), but that's mostly a historical reason (I've had it for a while). I know there are a couple of static site generators in Elixir that are actively being developed. I'm keen on trying them, but I haven't done so yet. One is github.com/elixir-tools/tableau and the other is vox (elixirforum.com/t/elixirconf-2023-geoffrey-lessel-introducing-vox-the-static-site-generator-for-elixir-lovers/60411). Hope that helps!
@user-tb4ig7qh9b
@user-tb4ig7qh9b 10 месяцев назад
I do not this thing matter a lot or have any difference it is same thing you work with elixir map if use your approach and with ecto you work with struct.
@germanvelasco
@germanvelasco 10 месяцев назад
Yeah, you can work with maps or structs. I like that this separates the UI (the form) from the database layer a little bit more than the traditional changeset that goes from the form all the way to the ecto schema. Of course, you can also use Ecto's changesets without a schema to back a form. I've done that in the past too. Both ways allow you to decouple the UI from the data that ultimately gets persisted into the database.
@user-tb4ig7qh9b
@user-tb4ig7qh9b 10 месяцев назад
@@germanvelasco you have a point but on my side i strict functions with the type of the schema i would use like def post_changeset(%Post{} = post, attrs) The reason get compile time error if i make a mistake. Maybe make it as a spec with the schema type not schema it self.
@user-tb4ig7qh9b
@user-tb4ig7qh9b 10 месяцев назад
@@germanvelasco The reason with that i have an issue with elixir lsp implementations so i get error earlier from iex
Далее
Phoenix Forms Backed by Embedded Schemas
2:45
Просмотров 1,1 тыс.
Kubernetes Operator simply explained in 10 mins
10:09
Просмотров 212 тыс.
Why use shadcn/ui and how to customise it?
26:35
Просмотров 9 тыс.
Getting Started with Phoenix LiveView (UPDATED)
15:56
Golang is OG?
5:16
Просмотров 5 тыс.
Phoenix LiveView Uploads Deep Dive
32:56
Просмотров 18 тыс.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Просмотров 175 тыс.
Самый СТРАННЫЙ смартфон!
0:57
Просмотров 32 тыс.
ДЕШЕВЫЙ НОУТБУК C OZON ЗА 17000р
13:00
Main filter..
0:15
Просмотров 12 млн
Игровой Комп с Авито за 4500р
1:00