Hi,
I want to preload the first 3 ranks for a list of tops. The following repository contains an example: https://github.com/obsidienne/bug_ecto
I have the following bug trace:
(Ecto.QueryError) deps/ecto/lib/ecto/association.ex:501: field BugEcto.Top.top_id
in where
does not exist in the schema in query:
from t in BugEcto.Top,
join: f in fragment("SELECT *, row_number() OVER (\n PARTITION BY top_id\n ORDER BY position DESC\n) FROM ranks\n"),
on: true,
where: f.row_number <= ^2 and f.top_id == t.id,
where: t.top_id in ^[32, 31],
order_by: [asc: t.top_id],
select: {t.top_id, t}
I think i’m doing something wrong or it’s an echo bug.
Any ideas ?
Thanks,