Hey, I have a question.
I am loading up radio buttons in a form based from db. I want the first radio button that shows up to be selected. For simple demo I am just going to use <li>s.
<% foo.bar.each do |baz| %>
<li><%= baz.bleh %></li>
<% end %>
In that example how do I make the first <li> have class="first"?
I'd use each_with_index instead of each, and then just test for i==0.
yes you can use the index of the object to get the desired result
Or you could use:
baz == foo.bar.first