rails in groups of code example Example: rails in groups of array = ['foo', 1, 'bar', 2] array.in_groups_of(2) # => [['foo', 1], ['bar', 2]]