I'm a bit fuzzy on how to work with multidimensional arrays in Ruby. How would I recreate this PHP code in Ruby?
$objs_array = array();
foreach($objs AS $obj) {
$objs_array[$obj->group_id][] = $obj;
}
}
print_r($objs_array);
The result would be:
Array
(
[123] => Array
(
[0] => Array
(
object1
)
[1] => Array
(
object2
)
)
[456] => Array
(
[0] => Array
(
object3
)
[1] => Array
(
object4
)
)
)
Thanks.