ruby on rails - How to update data in same column -


i having problem trying dynamically update data in table. using timetable module. in that, each day has 7 periods. example, on monday first period "english" , second period "maths".

however won't update same row. instead, "english" added in 1 row , "maths" added in row. how can solve problem?

_table.html.erb

<table class ="table">     <tr class = "info">         <th>day</th>         <th>periods/timing</th>         <th></th>      </tr>     <% @timetable.each |i| %>         <tr class = "info">             <td>*****</td>             <td><p><%= i. period %></p><p><%= i.start_time.strftime("%i:%m %p")  %>&nbsp;to&nbsp; <%= i.end_time.strftime("%i:%m %p")  %></p></td>         </tr>         <tr>              <td><%= i.day %></td>             <td><%= i.subject.subject %></td>         </tr>         <% end %> </table> 

in view, day -> monday, subject -> english in 1 row, day -> monday, subject -> maths in row. subject maths not updated in same column.

thats because have 2 <tr>s in loop. should this:

      <% @timetable.each |i| %>         <tr class = "info">           <td>             <p>               <%= i. period %>             </p>             <p>               <%= i.start_time.strftime("%i:%m %p") %> &nbsp;to&nbsp;               <%= i.end_time.strftime("%i:%m %p")  %>             </p>           </td>           <td><%= i.day %></td>           <td><%= i.subject.subject %></td>         </tr>          <% end %> 

Comments