3 ms·
If you create an has_many authentications association in the User schema your query could be as simple as this if you wanted to pick what you want to select out
by dugmartin 5y ago
If you create an has_many authentications association in the User schema your query could be as simple as this if you wanted to pick what you want to select out of the join:
from u in User,
join: a in assoc(u, :authentications),
select: %{id: u.id, name: u.name, some_column: a.some_column}
or if you just want to load all the authentications
from u in User, preload: [:authentications]
(Note: both of these queries are from memory and not tested, syntax errors may apply)