Rails Active Record Query for Double Nested Joins with a Select Call
问题 I have the following schema: Photos has many Groups has many Users. I am using this Rails server as a backend to an iOS application and constantly need to push out notifications to all involved users of a group when a photo is added. I problem is finding the least expensive query to resolve only the User.ids affected. So far I have Photo.find(1).groups.joins(:users) I know that I have to put a select argument after this, but can't figure out the syntax for the life of me. Given a photo, I am