Phoenix forms backed by embedded schemas

Notes

Last week I shared a tip on how to decouple forms from our databases by using a regular map with the to_form/2 helper.

People asked about another approach, and I wanted to share it here.

If you have complex forms that you want to decouple from the database, we can use Ecto’s embedded schemas to back a form. That gives us all the power of Ecto changesets without having to tie our form to our database schema!

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.