diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-10-20 17:30:01 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-10-20 17:30:01 +0000 |
commit | c9fecf20ffb051ebc9270bfd787fd2964349d19a (patch) | |
tree | 454db11b153b9d8383e044f4dad7153182a2042f /actionpack/lib | |
parent | 17ac677a2d8383812769640bcc15bd82141f29ee (diff) | |
download | rails-c9fecf20ffb051ebc9270bfd787fd2964349d19a.tar.gz rails-c9fecf20ffb051ebc9270bfd787fd2964349d19a.tar.bz2 rails-c9fecf20ffb051ebc9270bfd787fd2964349d19a.zip |
Ensure that cookies handle array values correctly. Closes #9937 [queso]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7978 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/cookies.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 36ace7b877..c40ef341a1 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -44,7 +44,10 @@ module ActionController #:nodoc: # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using cookies[]= # (for simple name/value cookies without options). def [](name) - @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) + cookie = @cookies[name.to_s] + if cookie && cookie.respond_to?(:value) + cookie.size > 1 ? cookie.value : cookie.value.to_s + end end def []=(name, options) |