dimanche 24 avril 2016

How to iterate after some data?

I have a product model with has_many images model

so on the first loop i just get the first 4 images

 <%  @product.images.first(4).each do |i| %>
    <li>
      <a href="<%= i.photo.url.to_s %>">
        <%= image_tag(i.photo.url(:small).to_s, :class => 'thumbnail circle', :'data-zoom-href' => i.photo.url(:big).to_s) %>
      </a>
    </li>
       <% end %>

how to loop the rest of images after the first 4 images?

i've tried this: without sucess!

 <ul>


  <%  @product.images.last.each do |i| %>
    <li>
      <a href="<%= i.photo.url.to_s %>">
        <%= image_tag(i.photo.url(:small).to_s, :class => 'thumbnail circle', :'data-zoom-href' => i.photo.url(:big).to_s) %>
      </a>
    </li>
       <% end %>


  </ul>

Aucun commentaire:

Enregistrer un commentaire