Build hash from elements of your Array using attribute as key and the element as value and return values of Hash:
Hash[*ary.map {|obj| [obj.name, obj]}.flatten].values
Look at this link for more info: http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.select