title: Rails - Retrieve data from multiple tables
body: <p>I have read so much about Rails in the past week in the process of trying to learn it. The problem is when I need something I find it difficult to recall where I read it! ha ha</p>
  
  <p>I have two models: Guest and Booking where Guests has_many Bookings. Therefore the Booking model has a guest_id field included.</p>
  
  <p>I would like to retrieve all the booking data and the guest data and display in a view as one object. I know I have seen a simple solution to this (in the Rails doc I think) that does just this.</p>
  
  <p>At the moment I'm doing the following in my BookingsController:</p>
  
  <pre><code>@bookings = Booking.all
  </code></pre>
  
  <p>and in my associated view I have:</p>
  
  <pre><code>&lt;% @bookings.each do |booking| %&gt;
    &lt;p&gt;&lt;%= booking.id %&gt;&lt;/p&gt;
    &lt;p&gt;&lt;%= booking.email %&gt;&lt;/p&gt; //this does not work as email is in guests table!!!
  &lt;% end %&gt;
  </code></pre>
  
  <p>but how can I get the linked Guest table included too?</p>