aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDavid Lee <davidomundo@gmail.com>2011-05-17 15:53:54 -0700
committerDavid Lee <davidomundo@gmail.com>2011-05-17 15:54:22 -0700
commitfb3ea8b8cb324d174e801d27dc15315b9358486f (patch)
tree5072e533e488c2916bf31adcffd2813a82c453b6 /activesupport
parent0a070a2444a5e2167e208c0b327af37d757ef70a (diff)
downloadrails-fb3ea8b8cb324d174e801d27dc15315b9358486f.tar.gz
rails-fb3ea8b8cb324d174e801d27dc15315b9358486f.tar.bz2
rails-fb3ea8b8cb324d174e801d27dc15315b9358486f.zip
Use dup to preserve previous behavior
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb2
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index 39ebc1ec82..15a3717ea1 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -11,7 +11,7 @@ module ActiveSupport
end
def with_indifferent_access
- self
+ dup
end
def initialize(constructor = {})
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index b2c85f15cb..2f0204731b 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -971,7 +971,7 @@ class HashToXmlTest < Test::Unit::TestCase
assert_nil hash_wia.default
end
- def test_should_return_self_for_with_indifferent_access
+ def test_should_return_dup_for_with_indifferent_access
hash_wia = HashWithIndifferentAccess.new
assert_equal hash_wia, hash_wia.with_indifferent_access
end