Using Ecto.Multi for Complex Database Transactions

Great article on Ecto.Multi! We definitely need more of those coming. :)

One very tiny suggestion: instead of calling Map.merge/2 with the, I would recommend setting the user_id directly in the Address, such as %Address{user_id:}. The main reasoning is that it is a best practice to keep the data you receive from the form and the data set by your application decoupled. For example, if you accidentally change the order of parameters in Map.merge/2, users would be able to set user_id through the form, effectively being able to add addresses to other users. So keeping them apart is a bit more bug proof.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.