I try to make the two columns list of products, this is my code
<table>
  <% ([email protected]).step(2) do |i| %>
    <tr><td><div id="product_left">
        <%= image_tag @products[i].photo.url(:small) %>
        <%= @products[i].name %><br/>
        Price: <%= @products[i].price %><br/>   
        <%= link_to "details", :action=>"show", :id=> @products[i].id %>
          
        <%= link_to "add to card", {:controller=> "carts", :action=>"add", :id=> @products[i].id}, :remote=> true %>
     </div> </td>
    <% if @products.length > i %>
     <td><div id="product_right">       
        <%= image_tag @products[i+1].photo.url(:small) %> 
        <%= @products[i+1].name %><br/>
        Price: <%= @products[i+1].price %><br/> 
        <%= link_to "details", :action=>"show", :id=> @products[i+1].id %>
          
        <%= link_to "add to card", {:controller=> "carts", :action=>"add", :id=> @products[i+1].id}, :remote=> true %>
     </div></td> 
     <% end %>
   </tr>
  <% end %>
  </table>
the problem is in the second div, rails give me an error on @products[i+1]. How can I solve it?
