Blog Archives

Ecto Composable Queries

For a while, I wondered how it was possible to prepare a query in Ecto that involves a join, then pass that query on and add a condition based on that join. The above example will look for the name

Posted in Ecto, Elixir

Phoenix Framework – Setting an associated ID back to nil using a form

When using a Phoenix Framework form, I had a select box on my page which had an option to set a belongs_to value to nil. The form would usually send the ID, but when the nil value is selected, it

Posted in Ecto, Elixir, Phoenix

Ecto DateTime arithmetic

Working with timestamps in Elixir is still very much a point of contention within the community. There is a pretty robust library emerging called Timex, but it is not now part of the core of Elixir or Phoenix. I think

Posted in Ecto, Elixir

Sample Phoenix Framework Controller

Hi all! Happy New Year. I’ve been playing around recently with the Phoenix Framework quite a lot. While I was learning it, I found myself wishing that a full-fledged example of a traditional MVC controller existed out there. I found

Posted in Ecto, Elixir Tagged with: , ,

Locking Records with Elixir’s Ecto

As a followup to a previous post about locking records with transactions, I’m now going to show how it’s done with Elixir, and specifically the Ecto library (comparable to ActiveRecord). Instead of using: Ecto asks you to pass the specific

Posted in Ecto, Elixir