I have a Ruby on Rails query ending by a .pluck(:id, :title) and giving me an array full of 2-dimensions arrays like so :
array = [[11145, "string1"], [11223, "string1"], [11205, "string2"], [11127, "string2"], [11080, "string3"], [11158, "string3"]]
I'd like to group the IDs by title in order to get this result:
[[[11145, 11223], "string1"], [[11205, 11127], "string2"], [[11080, 11158], "string3"]]
I've tried to concatenate the IDs directly in the SQL query or manipulate the array but didn't manage my expected result.
Any help is more than welcome. Thanks in advance.