<?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>a8ed10546d844fc15d87f5c8f168a18d0cdab5f0</id>
    </parent>
  </parents>
  <author>
    <name>Chris Hapgood</name>
    <email>cch1@hapgoods.com</email>
  </author>
  <url>http://github.com/Fingertips/rails/commit/6c59e5a558922b8f4084533071c3d93e151858ac</url>
  <id>6c59e5a558922b8f4084533071c3d93e151858ac</id>
  <committed-date>2009-11-05T00:17:13-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>21827e48685039c4e34fd13a2bdef967983ba416</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
