You can get the database to do the sorting and avoid multiple index calls, you just have to remember that an SQL ORDER BY orders by an expression, not a column:
whens = item_ids.collect.with_index { |id, i| "when #{id} then #{i}" }.join(' ')
items = Item.where(:id => item_ids).order("case id #{whens} end")