I don't think includes(:images) does anything  - I ran the Gallery.includes(:images) and Gallery.all and got the same size

For the scope, I had to do { joins(:images).uniq }