Jon Egil Stand wrote:
> If you have a Hash like this
> {1=>5, 19=>4, 9=>88}
> 
>>> h.keys.sort
> => [1, 9, 19]
> 
> sorts the keys.
> 
> 
> All the best
> Jon Egil

Yipee, this finally works! Thanks Jon!

I simply had to sort the keys and the iterate ofer the sorted keys, 
using the keys for indexing into the hash:

@sorted_keys = @parent_items.keys.sort

then

@sorted_keys.each do |key|
  @parent_items[key].do_whatever
  key.do_whatever
end

Easy, but still wonder why the other solutions don't work...
-- 
Posted via http://www.ruby-forum.com/.