<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -120,6 +120,13 @@ module ActiveSupport
         dup.merge!(other_hash)
       end
 
+      # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
+      def replace(other)
+        super
+        @keys = other.keys
+        self
+      end
+
       def inspect
         &quot;#&lt;OrderedHash #{super}&gt;&quot;
       end</diff>
      <filename>activesupport/lib/active_support/ordered_hash.rb</filename>
    </modified>
    <modified>
      <diff>@@ -191,4 +191,11 @@ class OrderedHashTest &lt; Test::Unit::TestCase
       assert_equal &quot;odd number of arguments for Hash&quot;, $!.message
     end
   end
+
+  def test_replace_updates_keys
+    @other_ordered_hash = ActiveSupport::OrderedHash[:black, '000000', :white, '000000']
+    original = @ordered_hash.replace(@other_ordered_hash)
+    assert_same original, @ordered_hash
+    assert_equal @other_ordered_hash.keys, @ordered_hash.keys
+  end
 end</diff>
      <filename>activesupport/test/ordered_hash_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4ae03b2d5a7b81a8b8d330c12de40f970525a67a</id>
    </parent>
  </parents>
  <author>
    <name>Chris Hapgood</name>
    <email>cch1@hapgoods.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/c3ef028b818779996472e018486446a216657251</url>
  <id>c3ef028b818779996472e018486446a216657251</id>
  <committed-date>2009-11-05T00:16:06-08:00</committed-date>
  <authored-date>2009-11-04T07:13:59-08:00</authored-date>
  <message>Fix OrderedHash#replace

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;</message>
  <tree>e48654d29cde5306ccac4ba5f10d3ae25b59d0ad</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
