Skip to content

Instantly share code, notes, and snippets.

@Bajena

Bajena/gist.rb

Created Jan 27, 2019
Embed
What would you like to do?
Rails joins
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
You can’t perform that action at this time.