Month: July 2016

Filtering has_many relationships in Ecto

This is sot-of a follow up to my last post, about self-referencing many_to_many relationships using Ecto. I find myself in a scenario where I have a User: # User model defmodule MyApp.User do use MyApp.Web, :model alias MyApp.Contact schema “users” do has_many :_internal_contacts, MyApp.Contact has_many :contacts, through: [:_internal_contacts, :contact] timestamps end end and an association…

Read the full article