Created
July 24, 2017 20:03
-
-
Save PragTob/e541d0e742d6464ff2ec2e6ab7eda52c to your computer and use it in GitHub Desktop.
Ecto explicit preloading in action
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
iex(13)> user = Repo.get_by(User, name: "Homer") | |
iex(14)> user.videos | |
#Ecto.Association.NotLoaded<association :videos is not loaded> | |
iex(17)> user = Repo.preload(user, :videos) | |
iex(18)> user.videos | |
# all the videos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment