2

I need to show all products in a responsive div - three products in a row on lg resolutions, two products in a row on md and sm resolutions and one product in a row on xs resolution.

What should my view markup look like? The following code doesn't work, of course, because every product display in a new row. I found similar question on Stackoverflow with using of the each_slice(3), but there was only lg resolution support in this case, and I need responsive markup.

<% @products.each do |product| %>
<div class="row">
    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
        <%= link_to image_tag(product.productphoto.url), product_path(product) %>
    </div>
</div>
Rustam Rakhimov
  • 115
  • 1
  • 7

0 Answers0