mercredi 15 juillet 2020

How to display empty td values which is coming from loop in a table in Rails views

https://i.stack.imgur.com/7M5eg.png

I have to show the images in a table td column. So, I wrote the loop for one td to show at least four images according to uploads. But when images attachments less than 4 another column values shifting to this td column. So, I need to display the empty one also. How to solve it. Here is my code

<% hp.fi_attachments.last(4).each_with_index do |fi,index| %>  
  <td>  
    <div class="image_address">
      <%= image_tag fi.image, :class => "style_image"%>  
    </div>  
  </td>
<%end%>

Aucun commentaire:

Enregistrer un commentaire