Created
February 22, 2018 14:31
-
-
Save coline-carle/a23c2b29c9c91bf2cbda8f04db4c9b55 to your computer and use it in GitHub Desktop.
ecto join table
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
defp pinned_raid_with_members(query) do | |
query | |
|> where(pinned: true) | |
|> join(:left, [raid], registrations in assoc(raid, :registrations)) | |
|> join(:left, [raid, registrations], member in assoc(registrations, :member)) | |
|> preload([raid, registrations, member], registrations: {registrations, member: member}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment