how do I create a table using loops and haml with ruby?

后端 未结 3 1186
旧时难觅i
旧时难觅i 2021-02-02 10:53

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]

<
3条回答
  •  独厮守ぢ
    2021-02-02 11:46

    You can use the each_slice like so:

    - @f_ary.each_slice(5) do |row|
      %tr
        - row.each do |cnt|
          td=cnt
    

提交回复
热议问题