title: how to make this code drier
body: <p>I am wondering if it is possible to make this code even simpler. I am worried t be hitting the database too many times with the same query. Here is my code:</p>
  
  <pre><code>#hot-panel.mdl-tabs__panel.is-active
   %ul.product-list-three.mdl-list
    - @merchant.products.where('products.prototype_id = 1').select(&amp;:id).flatten.uniq.each do |item|
     = render :partial =&gt; 'product', :locals =&gt; {:item =&gt; item }
  #cold-panel.mdl-tabs__panel
   %ul.product-list-three.mdl-list
    - @merchant.products.where('products.prototype_id = 2').select(&amp;:id).flatten.uniq.each do |item|
     = render :partial =&gt; 'product', :locals =&gt; {:item =&gt; item }
  </code></pre>
  
  <p>Here are the logs:</p>
  
  <pre><code>Product Load (1.1ms)  SELECT "products".* FROM "products" INNER JOIN "variants" ON "products"."id" = "variants"."product_id" INNER JOIN "variant_merchants" ON "variants"."id" = "variant_merchants"."variant_id" WHERE "variant_merchants"."merchant_id" = $1 AND (products.prototype_id = 1)  [["merchant_id", 1]]
  default_url_options is passed options: {}
  
    Rendered shopping/merchants/_product.html.haml (3.5ms)
    Product Load (1.2ms)  SELECT "products".* FROM "products" INNER JOIN "variants" ON "products"."id" = "variants"."product_id" INNER JOIN "variant_merchants" ON "variants"."id" = "variant_merchants"."variant_id" WHERE "variant_merchants"."merchant_id" = $1 AND (products.prototype_id = 2)  [["merchant_id", 1]]
    Rendered shopping/merchants/_product.html.haml (0.5ms)
  </code></pre>
  
  <p>Models
  Merchant</p>
  
  <pre><code> has_many :variant_merchants
   has_many :variants, through: :variant_merchants, dependent: :destroy
   has_many :products, through: :variants, dependent: :destroy
  </code></pre>
  
  <p>Product</p>
  
  <pre><code> belongs_to :prototype
   has_many :product_properties
   has_many :properties, through: :product_properties
  
   has_many :variants, dependent: :destroy
  </code></pre>
  
  <p>Variant</p>
  
  <pre><code> has_many :variant_merchants, dependent: :destroy
   has_many :merchants, through: :variant_merchants
  
   has_many :variant_properties
   has_many :properties, through: :variant_properties
  </code></pre>
  
  <p>Product Partial</p>
  
  <pre><code>= link_to shopping_merchant_product_path(@merchant, item.id) do
    %li.mdl-list__item.mdl-list__item--three-line
      %span.mdl-list__item-primary-content
        %span= item.name
        %span.mdl-list__item-text-body
          = item.description
      %span.mdl-list__item-secondary-content
        %i.material-icons
          chevron_right
  </code></pre>