Skip to content

Instantly share code, notes, and snippets.

@lodestone
Created May 2, 2019 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lodestone/8dcf1948ba26dbe12fffd8f3a1474a31 to your computer and use it in GitHub Desktop.
Save lodestone/8dcf1948ba26dbe12fffd8f3a1474a31 to your computer and use it in GitHub Desktop.
Example of annotating a sql query from Rails
Post.for_user(user).annotate("fetching posts for user ##{user.id}").to_sql
#=> SELECT "posts".* FROM "posts" WHERE ... /* fetching posts for user #123 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment