Skip to content

Instantly share code, notes, and snippets.

@timonv
Created January 6, 2016 20:40
Show Gist options
  • Save timonv/14de8017feb86683ac38 to your computer and use it in GitHub Desktop.
Save timonv/14de8017feb86683ac38 to your computer and use it in GitHub Desktop.
query = from workout in Workout,
where: workout.id == ^id,
left_join: group in assoc(workout, :workout_set_groups),
left_join: set in assoc(group, :workout_sets),
join: excercise in assoc(group, :excercise),
preload: [workout_set_groups: {group, excercise: excercise, workout_sets: set}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment