diff options
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 2 | ||||
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 91de722748..a19d6c3532 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -149,6 +149,8 @@ module ActiveSupport self end + alias_method :update, :merge! + def merge(other_hash, &block) dup.merge!(other_hash, &block) end diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index 0f36f5204d..dca5c5d0c0 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -244,4 +244,10 @@ class OrderedHashTest < Test::Unit::TestCase assert_equal @ordered_hash.keys, @deserialized_ordered_hash.keys assert_equal @ordered_hash.values, @deserialized_ordered_hash.values end + + def test_update_sets_keys + @updated_ordered_hash = ActiveSupport::OrderedHash.new + @updated_ordered_hash.update(:name => "Bob") + assert_equal [:name], @updated_ordered_hash.keys + end end |