So what you’re experiencing is that join performs an INNER JOIN which returns all the rows which have an associated row in the joined table. Replace join with left_join, and you should get the expected result.
def show(conn, %{"id" => id}) do
meeting = from m in Meeting, where: m.id == ^id,
left_join: p in assoc(m, :pictures),
preload: [pictures: p]
render(conn, "show.html", meeting: meeting)
No success…
How to join the pictures table correctly?
Thanks for supporting…
So, sorry for not understanding. But what is the problem right now? Left join is what you want to use in your situation. Or, as @mbuhot mentions, just preload without doing a join.
I have one “meeting” which has one or more pictures(or not)
If I show “meeting” i have to get the attached pics via pictures.meeting_id
left_join: p in assoc(m, :pictures), doing that?