I have been looking at the ruby-docs but have not been able to make sense of them. I have an application that generates a table and stores files in each cell, a user can add another file by clicking on the last box which says "Add file", but I can't figure out how to do this in ruby.
In PHP I would do something like this; if it helps anyone get an idea:
for($i = 0; $i <= $file_array.size; $i++){
  if($i%3=0){
   html .= "</tr><tr>"
  }
  if($i == $array.size){
   //Prevents out of bounds error
   html .= "<td><a href=\"...\">New File Link</a></td>"
  }
 else{
  //We are not out-of-bounds; continue.
  html .= "<td><a href=\"$file_array[$i]\">File Link</a></td>"
 }
}
In ruby I have
 object.files.each_with_index |attachment, i|
but, I don't know if that is what I want to use; I can't figure out how to use it.
Update: I forgot to put table cells in the code.
 
     
     
     
    