Ruby question here: I've got an array full of hashes, some of which are identical. How can I make take out all the duplicates hashes. I thought my_array.uniq! would do it... but um, it doesn't.
People succeed in answering ParagramStudios's questions 26% of the time (9 successes in 34 attempts).
Answers by: Rich Collins
Odd that uniq! doesn't work, but here is a solution:
the_array.inject([]) { |arr, hash| arr << hash unless arr.include?(hash); arr}