diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-23 23:45:27 +0000 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-23 23:45:27 +0000 |
commit | 7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85 (patch) | |
tree | ac081db672326a11910e9c46d93c9675c83c2e87 /activesupport | |
parent | 6da52c617e2a075b9d9e7142786f316d8f2c7930 (diff) | |
download | rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.tar.gz rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.tar.bz2 rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.zip |
Rely solely on active_model_serializer and remove the fancy constant lookup.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 1 | ||||
-rw-r--r-- | activesupport/test/class_cache_test.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 2f1066016b..1372e71a61 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -542,6 +542,7 @@ module ActiveSupport #:nodoc: key = key.name if key.respond_to?(:name) @store[key] ||= Inflector.constantize(key) end + alias :[] :get def safe_get(key) key = key.name if key.respond_to?(:name) diff --git a/activesupport/test/class_cache_test.rb b/activesupport/test/class_cache_test.rb index 87f61dcfc8..b96f476ce6 100644 --- a/activesupport/test/class_cache_test.rb +++ b/activesupport/test/class_cache_test.rb @@ -49,6 +49,11 @@ module ActiveSupport end end + def test_get_alias + assert @cache.empty? + assert_equal @cache[ClassCacheTest.name], @cache.get(ClassCacheTest.name) + end + def test_safe_get_constantizes assert @cache.empty? assert_equal ClassCacheTest, @cache.safe_get(ClassCacheTest.name) |