Skip to content

Instantly share code, notes, and snippets.

@paulcsmith
Last active June 30, 2016 15:15
Show Gist options
  • Save paulcsmith/61f8ebf041c36c6ef09f0e9d5f30c00a to your computer and use it in GitHub Desktop.
Save paulcsmith/61f8ebf041c36c6ef09f0e9d5f30c00a to your computer and use it in GitHub Desktop.
@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