If I change the association to an invalid has_many, then it works:
defmodule Molly.Franchise do
use Molly.Schema, :model
schema "franchises" do
field :name, :string
belongs_to :league, Molly.League
has_many :teams, Molly.Team
# This is kind of a fake for preloading groups in a hierarchy
# many_to_many :franchise_groups, Molly.FranchiseGroup, join_through: Molly.FranchiseAffiliation, join_keys: [franchise_id: :id, franchise_group_id: :id]
has_many :franchise_groups, Molly.FranchiseGroup
timestamps()
end
end
Of course I get a warning: "warning: invalid association franchise_groups
in schema Molly.Franchise: associated schema Molly.FranchiseGroup does not have field franchise_id
"