diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-03-04 17:11:34 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-03-04 17:11:34 -0500 |
commit | 475c96589ca65282e1a61350271c2f83f0d4044f (patch) | |
tree | 8401f8dad04a50dbcc6c72480713ee4ead296924 /activesupport/lib | |
parent | 705915ab5cf24430892107764b0050c07e1df583 (diff) | |
parent | 7d98247446e9f043dc9b6b5cbdb938877dd00a81 (diff) | |
download | rails-475c96589ca65282e1a61350271c2f83f0d4044f.tar.gz rails-475c96589ca65282e1a61350271c2f83f0d4044f.tar.bz2 rails-475c96589ca65282e1a61350271c2f83f0d4044f.zip |
Merge pull request #14269 from arthurnn/expanded_key_array
Cache key should be different when is Array.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index a627fa8651..f23f6f16d6 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -511,7 +511,7 @@ module ActiveSupport # called. If the key is a Hash, then keys will be sorted alphabetically. def expanded_key(key) # :nodoc: return key.cache_key.to_s if key.respond_to?(:cache_key) - + trailing_slash = false case key when Array if key.size > 1 @@ -519,11 +519,12 @@ module ActiveSupport else key = key.first end + trailing_slash = true when Hash key = key.sort_by { |k,_| k.to_s }.collect{|k,v| "#{k}=#{v}"} end - - key.to_param + key = key.to_param + trailing_slash ? "#{key}/" : key end # Prefix a key with the namespace. Namespace and key will be delimited |