diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-23 10:17:34 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-23 10:17:34 -0800 |
commit | 2c568f1e45ef0704a87881750252731a3adff52c (patch) | |
tree | 74a9cffdadee137499e31468a885cd5039ad6ef9 /activesupport/lib/active_support | |
parent | f62f545f7ccb23c4616e26dbf5ea4ee17ed7b079 (diff) | |
parent | a650dd05f82028e8d1310f1b68b7bc430ea47dcf (diff) | |
download | rails-2c568f1e45ef0704a87881750252731a3adff52c.tar.gz rails-2c568f1e45ef0704a87881750252731a3adff52c.tar.bz2 rails-2c568f1e45ef0704a87881750252731a3adff52c.zip |
Merge pull request #3738 from exviva/issues/3737_AS_cache_expand_cache_key
Issues/3737 AS::Cache.expand_cache_key
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 2bf24558a6..12eeff4f4b 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -81,16 +81,10 @@ module ActiveSupport end expanded_cache_key << - if key.respond_to?(:cache_key) - key.cache_key - elsif key.is_a?(Array) - if key.size > 1 - key.collect { |element| expand_cache_key(element) }.to_param - else - key.first.to_param - end - elsif key - key.to_param + case + when key.respond_to?(:cache_key) then key.cache_key + when key.is_a?(Array) then key.map { |element| expand_cache_key(element) }.to_param + else key.to_param end.to_s expanded_cache_key |