I'm trying to make an html table that looks like this:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
My data structure is like this: @f_ary = [ 1..250]
Here's my haml code:
%table{:border => "1"}
%tbody
%tr
- cnt = 0
- @f_ary.each do |f|
- cnt += 1
%td= cnt
- if cnt == 5
- cnt = 0
%tr
My current output looks like this:
<table border='1'>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<tr></tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>
I want it to look like this:
<table border='1'>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>