diff options
author | Olek Janiszewski <olek.janiszewski@gmail.com> | 2011-12-16 17:58:22 +0100 |
---|---|---|
committer | Olek Janiszewski <olek.janiszewski@gmail.com> | 2011-12-16 17:58:25 +0100 |
commit | abe915f23777efe10f17d611bf5718ca855a0704 (patch) | |
tree | c97235d2548f23930ed997cbeb7663aecc35d25b /activesupport/lib | |
parent | 4e74bd194beb6f51ee7c4bf06bfaab72d70f1c2c (diff) | |
download | rails-abe915f23777efe10f17d611bf5718ca855a0704.tar.gz rails-abe915f23777efe10f17d611bf5718ca855a0704.tar.bz2 rails-abe915f23777efe10f17d611bf5718ca855a0704.zip |
Fix expanding cache key for single element arrays
In short:
expand_cache_key(element) should not equal expand_cache_key([element])
This way a fragment cache key for an index page with only a single
element in the collection is different than a fragment cache for a
typical show page for that element.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 07f5fcdeb3..6452bed506 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -90,7 +90,7 @@ module ActiveSupport def retrieve_cache_key(key) case when key.respond_to?(:cache_key) then key.cache_key - when key.is_a?(Array) then key.map { |element| retrieve_cache_key(element) }.to_param + when key.is_a?(Array) then ['Array', *key.map { |element| retrieve_cache_key(element) }].to_param else key.to_param end.to_s end |