aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/ordered_hash.rb
diff options
context:
space:
mode:
authorChris Hapgood <cch1@hapgoods.com>2009-11-04 10:13:59 -0500
committerMichael Koziarski <michael@koziarski.com>2009-11-05 21:17:13 +1300
commit6c59e5a558922b8f4084533071c3d93e151858ac (patch)
tree21827e48685039c4e34fd13a2bdef967983ba416 /activesupport/lib/active_support/ordered_hash.rb
parenta8ed10546d844fc15d87f5c8f168a18d0cdab5f0 (diff)
downloadrails-6c59e5a558922b8f4084533071c3d93e151858ac.tar.gz
rails-6c59e5a558922b8f4084533071c3d93e151858ac.tar.bz2
rails-6c59e5a558922b8f4084533071c3d93e151858ac.zip
Fix OrderedHash#replace
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activesupport/lib/active_support/ordered_hash.rb')
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index 4324e40cbb..b492648610 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -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
"#<OrderedHash #{super}>"
end