Hello...I've searched before posting but can't find anything. New and
need help.
I want to iterate through some fields in my database table and populate
a html table with their values.

As an example, lets say I have a table (named race) that holds
information on a relay race. I have fields leg1, leg2...leg36 that hold
the miles per leg. I want to be able to run through a loop from 1 to 36
and displays all the legs. I thought this would work:

<b>Name:</b>
  <%=h @race.name %>
.....

<tr>
 <% 36.times do |p| %>
     <td>Leg <%= @race.leg+p %></td>
 <% end %>
</tr>

But I can't combine @race.leg and p.
Is there a way to increment @race.leg so I don't have to write
@race.leg1 [EMAIL PROTECTED]  ?

Any help appreciate - thanks!
...Bill
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
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