On 30 July 2010 03:48, Angel Robert Marquez <[email protected]> wrote:
> <% @items.each do |item| %> <div class="item<%= item.id %>">
> <%= item.record-name %>
> </div> <% end %>

>> I'm trying to render a list of div's with ids "item1", "item2", "item3",

If you're specifically after "item1" rather than "item<item.id>", then
you can use "each_with_index":

<% @items.each_with_index do |item, index| %>
  <div class="item<%= index+1 %>">
    <%= item.record-name %>
  </div>
<% end %>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to