Skip to content

Instantly share code, notes, and snippets.

@sergey-chechaev
Last active May 15, 2019 13:47
Show Gist options
  • Save sergey-chechaev/17a085c5398b9ac39a0070b9d0be57ea to your computer and use it in GitHub Desktop.
Save sergey-chechaev/17a085c5398b9ac39a0070b9d0be57ea to your computer and use it in GitHub Desktop.
def list_user_posts(user_id) do
Post
|> where([p], p.user_id == ^user_id)
|> preload([:post_photos, user: [:country, :city]])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment