title: Get all relations to members in a relation
body: <p>Let's say I have three models (models changed, I wouldn't use a has_many :through for this kind of relationship normally):</p>
  
  <pre><code>class User &lt;&lt; ActiveRecord::Base
      has_many :image_users
      has_many :images, through: :image_users
  end
  class ImageUser &lt;&lt; ActiveRecord::Base
      belongs_to :user
      belongs_to :image
  end
  
  class Image &lt;&lt; ActiveRecord::Base
      has_many :image_users
      has_many :users, through: :image_users
      has_many :comments, through: :image_comments
  end
  
  class ImageComment &lt;&lt; ActiveRecord::Base
      belongs_to :image
      belongs_to :comment
  end
  
  
  class Comment &lt;&lt; ActiveRecord::Base
      has_many :image_comments
      has_many :images, through: :image_comments
  end
  </code></pre>
  
  <p>Given a user, how do I select all comments on their images? Ideally I'd do this with ActiveRecord or SQL to avoid loading lots of objects into memory. Hopefully this hasn't been asked before, it was pretty difficult to google for.</p>