Created
October 15, 2019 21:36
-
-
Save nietaki/c1000f2422062c3ce92706b2cd320610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
simpler_query = from(c in Comment, where: c.user_id == ^charlie_id) | |
non_preloaded = Repo.all(simpler_query) | |
assert Enum.all?(non_preloaded, fn c -> c.post == nil end) | |
comments_by_charlie = Repo.preload(non_preloaded, [:post]) | |
refute Enum.any?(comments_by_charlie, fn c -> c.post == nil end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment