title: Rails - Painting a HTML Table with RUBY Data
body: <p>I want to create a table such as the below with my data which is stored in Ruby Arrays:</p>
  
  <pre><code>______________________________________________________________
  |    BUILD     |    PLATFORM    |       CATEGORY             |
  |______________|________________|____________________________|
  |              |                |      IP                    |
  |              |   8k           |____________________________|
  |              |                |      UMTS                  |
  |              |________________|____________________________|
  |   10.0.1.50  |                |      IP                    |
  |              |                |____________________________|
  |              |                |      UMTS                  |
  |              |   9k           |____________________________|
  |              |                |      Stability             |
  |______________|________________|____________________________|
  |              |                |      IP                    |
  |   10.0.1.51  |   8k           |____________________________|
  |              |                |      UMTS                  |
  |______________|________________|____________________________|
  |              |                |      IP                    |
  |   11.0.1.50  |   9k           |____________________________|
  |              |                |      UMTS                  |
  |______________|________________|____________________________|
  </code></pre>
  
  <p>I have the following data in 3 of my arrays:</p>
  
  <pre><code>Arr1 
  -------------------
  row[0]    : row[1]
  -------------------
  11.0.1.50 :    2 
  10.0.1.51 :    2 
  10.0.1.50 :    5 
  
  
  Arr2
  ---------------------------
  row[0]    : row[1] : row[2]
  ---------------------------
  11.0.1.50 : 9k     : 2 
  10.0.1.50 : 9k     : 3 
  10.0.1.51 : 8k     : 2 
  10.0.1.50 : 8k     : 2 
  
  Arr3
  -------------------------------
  row[0]    : row[1]  : row[2]
  -------------------------------
  10.0.1.50 : 8k      : IP 
  10.0.1.50 : 8k      : UMTS 
  10.0.1.51 : 8k      : IP 
  10.0.1.51 : 8k      : UMTS 
  10.0.1.50 : 9k      : IP 
  10.0.1.50 : 9k      : Stability 
  10.0.1.50 : 9k      : UMTS 
  11.0.1.50 : 9k      : IP 
  11.0.1.50 : 9k      : UMTS 
  </code></pre>
  
  <p>All those numbers in the arrays basically give me a count of the rowspan I might need for that particular entry. </p>
  
  <p>I wrote some code in my rails view, but it does not seem to give me the desired output:</p>
  
  <pre><code>&lt;% @l1_reg.each_with_index do |row1, index1| %&gt; 
              &lt;table&gt;
                  &lt;tr&gt;
  
                  &lt;!-- Build --&gt;
                  &lt;td rowspan='&lt;%= row1[1] %&gt;'&gt;&lt;strong&gt;&lt;%= row1[0] %&gt;&lt;/strong&gt;&lt;/td&gt;
  
  
                      &lt;% @l2_reg.each_with_index do |row2, index2| %&gt; 
                      &lt;% if ((row2[0].to_s == row1[0].to_s) %&gt;
  
                      &lt;!-- Platform --&gt;
                      &lt;td rowspan='&lt;%= row2[1] %&gt;'&gt;&lt;strong&gt;&lt;%= row2[0] %&gt;&lt;/strong&lt;/td&gt;
  
  
                          &lt;% @l3_reg.each_with_index do |row3, index3| %&gt; 
                          &lt;% if ((row3[0].to_s == row2[0].to_s) &amp;&amp; (row3[1].to_s == row2[1].to_s)) %&gt;
  
                              &lt;!-- Category --&gt;
                              &lt;td&gt;&lt;%= row3[2] %&gt;&lt;/td&gt;
  
  
                          &lt;% end %&gt;
                          &lt;% end %&gt;
  
  
                      &lt;% end %&gt;
                      &lt;% end %&gt;
  
                  &lt;/tr&gt;
               &lt;/table&gt;  
          &lt;% end %&gt;
  </code></pre>