diff options
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) |