i using each_slice
group records inside different divs
. how can find out how many div/groups, each_slice
has generated , add group number inside each div.
example
array = ["a", "b", "c", "d"] - array.each_slice(2) **result =>** %div.main-div %h1 div 1 %div %h1 %div %h1 b %div.main-div %h1 div 2 %div %h1 c %div %h1 d
something this
slicer = array.each_slice(2) groups = slicer.count slicer.with_index {|a, i| p "#{i + 1}: #{a}" }
Comments
Post a Comment