title: HTML Table issue grabbing data from two database tables
body: <p>Iam having an issue getting data from two different database tables to display properly with in an HTML table. I'm sure I am just overlooking something and this is pretty easy, but for whatever reason I cannot get quantity to display, or the <code>&lt;td class="sub-total"&gt;</code> to display either.</p>
  
  <p>Demands (you can think of these as orders) and items are connected through a table called demand_items. The demand_items table also has the quantity of the item ordered. The page will display but the quantity and the subtotal will not render.</p>
  
  <p>Here is the html: </p>
  
  <pre><code>&lt;h3&gt;Order for &lt;%= @demand.customer.name %&gt;&lt;/h3&gt;
  &lt;h4&gt;Ordered for: &lt;%= @demand.date %&gt;&lt;/h4&gt;
  &lt;h4&gt;Add Items&lt;/h4&gt;
  
  &lt;%= render 'demands/item_form' %&gt;
  
  &lt;table class="customer-table"&gt;
  &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Quantity&lt;/th&gt;
      &lt;th&gt;Sub Total&lt;/th&gt;
  &lt;/tr&gt;
  
  &lt;% @demand.items.each do |item| %&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;%= item.name %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= item.price %&gt;&lt;/td&gt;
     &lt;% @demand.demand_items do |quantity| %&gt;
      &lt;td&gt;&lt;%= quantity.quantity %&gt;&lt;/td&gt;
      &lt;td class="sub-total"&gt;&lt;%= (item.price) * (quantity.quantity) %&gt;&lt;/td&gt;
      &lt;% end %&gt;
       &lt;% end %&gt;
  
  &lt;/tr&gt; 
  
  &lt;/table&gt; 
  </code></pre>