Topic: Get sub-result of mass-query

Hi,
I´m optimizing Ruby project. I found out that major problem of the project is that there is a lot of single sql queries in loop so I load them at once with array of type_arrays..
items = Item.find_by_id(type_array) #I can get several items for one type, there are hundrer of types, I want load them at once

My project became faster but now I found such place where I want to load such items at once but group them or select them by id
How can I select such result?
subitems = items.select ( |i| i[":type]==some_type) #this doesn´t work, I need something similar

Can I store items in two-dimensional array during sql-load? Something like..
subitems = Item.find_by_id(type_array, :group => type) #this doesn´t work

I don´t want search loop, or loop of sql queries. I hope there is an elegant way to get sub-select from loaded data from DB selected by some parameter..

Thanks for Hints..