or subscribe with
Join 3,000+ readers for one email each week.
Digests » 81
this week's favorite
One of the cool things to come out of Ecto 2.0 is the module Ecto.Multi. It is designed to be a way to group database calls into a single transaction so that the group fails if one fails. In other words, it’s all or nothing. This takes care of the problem we see above. There are no multiple levels of nesting and the API is actually really nice to work with. Let’s take a look!
There are a few good examples showing how to use OAuth authentication in Phoenix and Elixir, but I wanted a solution which used a small amount of dependencies, and had the ability to make authenticated requests on behalf of a user.
Plasm generates Ecto models based on existing database tables in your database. Currently, Ecto only allows the ability to create migrations that creates new tables/schemas. If you have an existing project that you want to add Ecto support for you would have to hand code the models. This can be tedious for tables that have many columns.
One of the new additions in Elixir 1.4 that I’ve been looking forward to is the new Registry module. Lets look at one way to take advantage of this handy feature that is now part of the core library.
This guide assumes you are familiar with the basic flow, which you might have experienced in Slack or a growing number of apps: You provide an email address and get a magic link email containing a one time authentication token. The token is valid for a short period of time, clicking the link redeems it and signs you in – no more passwords!