I have an array of thing objects, each of which has an array of categories. I'd like to build a category hash with a category ID for a key and an array of things for a value.category_hash = Hash.newthings.each { |thing|  thing.categories.each { |category|    category_hash[category] = Array.new unless category_hash[category]    category_hash[category] << thing  }}Purely for education, how can this be shortened?
Array to a hash, ruby code reduction
ruby