ActiveSupport::OrderedHash#update Does Not Set Keys

Hi all,

On versions of Ruby prior to 1.9, using update on an
ActiveSupport::OrderedHash will not set the keys correctly. This means
that it is not possible to iterate over the hash using each or get the
array of keys.

For example:

    hash =
    hash.update(:name => "Bob")
    # => #<OrderedHash {:name=>"Bob"}>
    # => []
    hash.each do |key, value|
      puts value
    # => []

This can be resolved by simply aliasing update to merge! as per
Rubinius' implementation (c.f.

I have posted a patch including tests at
and would appreciate any feedback whatsoever.