I’m not sure exactly what you mean by “on the same line”, but you treat them as two different associations. For example here are some samples:
defmodule Ex338.Waiver do
schema "waivers" do
belongs_to :add_fantasy_player, Ex338.FantasyPlayer
belongs_to :drop_fantasy_player, Ex338.FantasyPlayer
end
def query(query) do
from w in query,
inner_join: a in assoc(w, :add_fantasy_player),
inner_join: d in assoc(w, :drop_fantasy_player)
end
def preload_assocs(query) do
from w in query,
preload: [:add_fantasy_player, :drop_fantasy_player]
end
end
defmodule Ex338.FantasyPlayer do
schema "fantasy_players" do
has_many :waiver_adds, Ex338.Waiver, foreign_key: :add_fantasy_player_id
has_many :waivers_drops, Ex338.Waiver, foreign_key: :drop_fantasy_player_id
end
def waiver_adds(query) do
from f in query,
inner_join: w in assoc(f, :waiver_adds),
preload: [:waiver_adds]
end
end






















