Pål Bergström wrote:
> How do I iterate a HashWithIndifferentAccess? I need to set the order
> using a sortable_element.

As Michael said, order is not guaranteed -- even if you include an 
element for that.

When I need to count on the order I use an array of pairs. I use this 
for value list data. It's not as handy as Lasso's array of pairs which 
are sortable and searchable, but it's a close as we get.

list = [ ["Small", "S"], ["Medium","M"], ["Large","L"] ]

If you have to start with the Hash, and it includes a sort number of 
some type, then you can modify the conversion to specifically retrieve 
the by the sort number.

If you need help with that, give an exampe of the exact data structure 
you'd be starting with.

-- gw

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to