Created
July 14, 2017 12:19
-
-
Save roryfranklin/0fad0bcb619e352b3b16d2f722e1369f 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
irb(main)> user = User.first | |
User Load (1.6ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT ? [["LIMIT", 1]] | |
=> #<User id: 1, created_at: "2017-07-13 18:28:46", updated_at: "2017-07-13 18:28:46"> | |
irb(main)> user.reviews.first.author.object_id == user.object_id | |
Review Load (2.7ms) SELECT "reviews".* FROM "reviews" WHERE "reviews"."author_id" = ? ORDER BY "reviews"."id" ASC LIMIT ? [["author_id", 1], ["LIMIT", 1]] | |
User Load (6.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]] | |
=> false | |
irb(main)> user.cars.first.user.object_id == user.object_id | |
Car Load (1.7ms) SELECT "cars".* FROM "cars" WHERE "cars"."user_id" = ? ORDER BY "cars"."id" ASC LIMIT ? [["user_id", 1], ["LIMIT", 1]] | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment