Skip to content

Instantly share code, notes, and snippets.

@elbow-jason
Forked from timonv/workout_controller.ex
Created January 6, 2016 20:41
Show Gist options
  • Save elbow-jason/696174bf7d5c0a320a79 to your computer and use it in GitHub Desktop.
Save elbow-jason/696174bf7d5c0a320a79 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