I have a store application and want my store items to display in a 3 column catalog. I want the 4th item to move to a new row automatically after the 3rd item is placed on the 3rd column on the first row. All items will be called from the database.
How can I acheive displaying my product catalog like thumbnails. At the moment this is what I have in my index.html.erb
<% @products.each do |product| %>
<table>
<tr>
<th>
<div class="entry">
<div class="card-title" >
<%=h product.title %></div> <%= image_tag(product.image_url) %>
<div class="price-line">
<span class="price"><%= number_to_currency(product.price, :unit => "N", :format => "%u%n") %></span>
</div>
<% form_remote_tag :url => { :action => 'add_to_cart', :id => product } do %>
<%= submit_tag "Add to Cart" , :class => "add_button" %>
<% end %>
</div>
</th>
</tr>
</table>
<% end %>
At the moment every item is shown in just one column but I want to display items like this:
Item A Item B Item C
Item D Item E Item F
Item G ...... ......
Any help will be appreciated. I'm new to RoR.
Thanks. Ijespal