title: deeply nested joins in activerecord
body: <p>I'm trying to optimize my queries throughout my site. </p>
  
  <p>I have 3 models, Photo, Person, Appearances</p>
  
  <p>Photo has_many appearances, and many people through appearances
  Appearances table just has a person_id, photo_id</p>
  
  <p>Now, if I were to do a search on a 'Person' and I wanted to eager load their appearances and photos, I would do something like this: </p>
  
  <pre><code> Person.joins(:appearances =&gt; :photo).limit(5)
  </code></pre>
  
  <p>Now, I'm not sure if this is ideal, but hypothetically my person has appearances which belongs to a photo, which in turn has appearances and other people. I don't even know if or how you'd do this in vanilla SQL, but I am just curious if this is possible. </p>
  
  <pre><code>  Person.joins(:appearances =&gt; :photo =&gt; :appearaces =&gt; :person).limit(5)
  </code></pre>
  
  <p>This syntax results in errors, again, I'm just curious, I'm handling getting the appearances and people of a photo inside my views, I just wanted to experiment with load times and see if this was even possible. </p>