Last active
June 20, 2019 22:31
-
-
Save skarger/a86c605930244f89471ae62b9733a0a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # 1 query to get all 3 sports | |
| sports = Sport.all | |
| # N == 3 queries to get each sport's workouts | |
| sports.each do |sport| | |
| puts sport.name | |
| puts sport.workouts.pluck(:notes).join("\n") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment