ActiveSupport::OrderedHash disappears?

Hello, i have asked this question here: ActiveSupport::OrderedHash disappears? - Rails - Ruby-Forum, but maybe you can answer quickly.

Is ActiveSupport::OrderedHash going to be maintained in Rails?

Its API page disappeared.

I do not want to rely on Hash’s being ordered in Ruby 1.9 (mainly because it is not called OrderedHash).

Thank you,


Why don't you want to rely on it? It's documented behaviour, so you can totally rely on it.

If your target deployment is Ruby 1.9, you *should* use Hash that come with Ruby. It's guaranteed to be sorted, and it doesn't have the same overhead that AS::OrderedHash has.

Do you know that AS::OrderedHash is an array within array, and it's very slow? Hash in 1.9 is written in C, and doesn't suffer the same slowness.

- Prem

Yes, it’s going to be maintained, probably until version 4.0 of Rails that will drop Ruby 1.8 support

We won't remove it until Rails 4. Even then, I'm not sure it will be removed. It will just == Hash.

Andrew, i read that many disagreed with Hash’s being ordered, and i think they have a reason for that.

After all, it is called Hash.

So i was wondering if i could use a more appropriately named structure for an ordered hash (even if it will be identical with Hash in implementation).

Thank you all for explanations.


I also think that documenting this behavior of Hash could be a mistake, if some day there will exist a better implementation of a pure has than a doubly-circular linked list as in Ruby 1.9 (some kind of a tree?)


If you're on 1.9 there is no slowdown with using OrderedHash vs Hash, as OrderedHash basically just inherits from Hash and does nothing else.

Thanks Jon, this is the kind of a solution i was hoping for.


Nice! I didn't know this.

Thanks for sharing :slight_smile: