This project is archived and is in readonly mode.

#4973 ✓committed
Paul Mucur

[PATCH] ActiveSupport::OrderedHash#update Does Not Set Keys

Reported by Paul Mucur | June 25th, 2010 @ 08:28 PM

Using update on an ActiveSupport::OrderedHash does not set keys correctly meaning that it cannot be iterated over with each, etc.

For example:

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

This can be fixed by aliasing update to merge! as is done in Rubinius' Hash implementation (c.f. ).

Please find attached a patch and test case to resolve this issue.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket