Pair of blocks in each?
-
19-09-2019 - |
Question
As in the standart cycle:
- @goods.each do |good|
???
...to organize this (HAML):
.columns-wrapper
.column First good
.column Second good
.column Third good
.columns-wrapper
.column Fourth good
.column Fifth good
.column Sixth good
Solution
From your example, it doesn't look like you want multiple blocks — you want to turn one dataset into several. I think what you want is each_slice(3)
.
OTHER TIPS
require 'active_record'
@goods.in_groups_of 3, false do |goods|
goods.each do |good|
...
end
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow