[Rails] html tag id from variable
I would like to create the id portion of a <td> tag using a string
variable. In my program i have a table that will have a varying number
of columns determined by a variable in the parameter file, $gItems. I
would like to be able to loop through each row labeling each column
based on its column number as shown below. The problem is i do not know
how to have the variable "item" read into the tag. Any solution or
other suggestion on how to solve this problem would be appreciated.
[code]
<table>
<tr>
<%for item in 0..$gItems%>
<td id="col" + item.to_s >
<%= "col" + item.to_s %>
</td>
<%end%>
</tr>
</table>
[/code]
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home