# OrderedHash Rails 2.3.2

**URL:** <https://www.ruby-forum.com/t/orderedhash-rails-2-3-2/182176>\
**Category:** Rails\
**Created:** [January 24, 2010, 3:50am UTC](https://www.ruby-forum.com/t/orderedhash-rails-2-3-2/182176 "2010-01-24T03:50:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [January 24, 2010, 3:50am UTC](https://www.ruby-forum.com/t/orderedhash-rails-2-3-2/182176/1 "2010-01-24T03:50:56Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [January 24, 2010, 10:50am UTC](https://www.ruby-forum.com/t/orderedhash-rails-2-3-2/182176/2 "2010-01-24T10:50:31Z")

</div>

On 24 Jan, 02:48, doug [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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

---

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [January 24, 2010, 6:24pm UTC](https://www.ruby-forum.com/t/orderedhash-rails-2-3-2/182176/3 "2010-01-24T18:24:40Z")

</div>

> 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

Wow! 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
```
