I have the following code in my Orders view:

```
<div class="grid heading">
  <div class="grid wrap">
    <div class=" unit whole">
      <h1>Orders</h1>
    </div>
  </div>
</div>

<div class="grid wrap">
  <div class="unit whole">
    <p id="notice"><%= flash[:notice] %></p>
    <p id="alert"><%= flash[:alert] %></p>
  </div>
</div>

<% @vendors.each do |vendor| %>
  <h2><%= vendor.name %></h2>
  <% @locations.each do |location| %>
    <h3><%= location.address %></h3>
    <% @orders.each do |order| %>
      <div class="grid wrap">
        <div class="unit whole">
          <table>
            <thead>
              <tr>
                <th>SKU</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <% order.line_items.each do |line_item| %>
              <tr>
                <td><%= line_item.product_sku %></td>
                <td><%= line_item.product_description %></td>
                <td></td>
              </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      </div>
    <% end %>
  <% end %>
<% end %>

```

Order model:

```
class Order < ActiveRecord::Base
  belongs_to :location
  belongs_to :vendor
  has_many :line_items

  accepts_nested_attributes_for :line_items
end

```

Location model:

```
class Location < ActiveRecord::Base
  has_many :orders
end

```

Vendor model:

```
class Vendor < ActiveRecord::Base
  has_many :orders
end

```

LineItem model:

```
class LineItem < ActiveRecord::Base
  belongs_to :order
end

```

I need the following sample output:

```
Vendor A
   Location 1
      Order:
        1. sku:111, description:zzz
        2. sku:222, description:yyy
   Location 2
      Order:
        1. sku:333, description:zzz
        2. sku:444, description:yyy

Vendor B
   Location 1
      Order:
        1. sku:aaa, description:zzz
        2. sku:bbb, description:yyy
   Location 2
      Order:
        1. sku:ccc, description:zzz
        2. sku:ddd, description:yyy

```

and so on.

However, it's showing all orders under all locations and all locations under all vendors.