Ecto and preloading most recent record from association

Well yeah, I could do that, but I don’t want to.

So someone takes all the trouble of writing an answer and your reply is “I don’t want to”? Can you at least clarify what is wrong with his response? It includes everything you need to make it work:

def with_top_versions(query) do
  post_versions = from pv in PostVersions, limit: 10
  from query, preload: [post_versions: post_versions]
end

Post |> Post.with_top_versions

I had dealt with this sort of crap for seven years using ActiveRecord. Enough is enough.

And I have dealt with this sort of feedback for years as well. If using Moebius is going to redirect this sort of feedback elsewhere, then please move on.

13 Likes