title: Rails joins(includes) belongs_to model
body: <p>I've got a model User, which has many Photo. </p>
  
  <p>I need to get users feed(photos from other users, users should be included), so query will be:</p>
  
  <pre><code>Photo.where(:user_id =&gt; Relationship.select(:followed_id).where(:follower_id =&gt; user.id)&lt;&lt;user.id).joins(:user)
  </code></pre>
  
  <p>But I get only photos, without user information. Is it possible to make query which returns something like this:</p>
  
  <pre><code>({user:{},photo:{}},{user:{},photo:{}},{user:{},photo:{}})
  </code></pre>