drhenner/ror_ecommerce

View on GitHub
app/views/admin/merchandise/multi/variants/_variant.html.erb

Summary

Maintainability
Test Coverage
<tr >
  <td> <%= variant_form.text_field :sku %> </td>
  <td> <%= variant_form.text_field :price %> </td>
  <td> <%= variant_form.text_field :cost %> </td>
  <% @product.properties.each do |property| %>
    <% variant_id = variant.id rescue nil %>
    <% variant_property = property.variant_properties.find_or_initialize_by(variant_id: variant_id) if variant_id %>
    <% variant_property ||= VariantProperty.new( property_id: property.id ) %>
      <%= variant_form.fields_for :variant_properties,
                       variant_property  do |variant_property_form|%>
        <td>
          Primary? <%= variant_property_form.check_box  :primary %>
        </td>
        <td >
            <%= variant_property_form.hidden_field  :property_id %>
            <%= variant_property_form.text_field    :description %>
        </td >
      <% end %>
  <% end %>
</tr >