Created
January 27, 2019 21:23
-
-
Save Bajena/e5de36f4d3115e77683499e57fc536fb to your computer and use it in GitHub Desktop.
Rails joins
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
Post.joins(:users).where(users: { country_code: 'PL' }).map { |post| post.title } | |
# SELECT "posts".* FROM "posts" INNER JOIN "users" ON "posts"."user_id" = "users"."id" WHERE "users"."country_code" = $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment