-
-
Save paulcsmith/61f8ebf041c36c6ef09f0e9d5f30c00a to your computer and use it in GitHub Desktop.
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
@user = User.first | |
# If I do this... | |
@user.comments # ...it raises at compile time because the association was not eager loaded | |
# If I do this... | |
@user.eager_load(:comments) | |
@user.comments # ...it returns the associated comments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment