I understand that ActiveSupport::OrderedHash.new [[1,2]] does not work beginning with Rails 2.3. I am running Rails 2.3.2. One commentator suggested simply creating the instance without arguments and then sequentially adding each element as a separate step. I tried that. The hash gets populated just fine but it is not ordered. Can anyone please tell me what the magic trick is under Rails 2.3.2 to create an instance of an ordered hash and then populate it with ordered data? Thanks for any input. ... doug -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 Jan, 02:48, doug <ddjol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I understand that > > ActiveSupport::OrderedHash.new [[1,2]] > > does not work beginning with Rails 2.3. I am running Rails 2.3.2. > One commentator suggested simply creating the instance without > arguments and then sequentially adding each element as a separate > step. I tried that. The hash gets populated just fine but it is not > ordered. Can anyone please tell me what the magic trick is under > Rails 2.3.2 to create an instance of an ordered hash and then populate > it with ordered data? Thanks for any input.How did you check that it was not ordered? Console output may not have the correct order, but iterating with each and similar functions should fred> > ... doug-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> How did you check that it was not ordered? Console output may not have > the correct order, but iterating with each and similar functions > shouldWow! I guess that it is ordered! To answer your question, the way I checked the ordering was to send my_ordered_hash.inspect to a disk file and then I looked at it. Apparently that methodology is not always truthful about the order either. Thanks so much for the input. ... doug -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.