diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 00:15:58 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 00:15:58 +0000 |
commit | ad354b207a5600fbe7c784f370cf30446925f13c (patch) | |
tree | 1c0b6091c713580ce3d359ba4f2161a7dc509465 /actionpack/lib/action_controller/cookies.rb | |
parent | cf6282099d93f929cc08e8c362b085f36811f2cc (diff) | |
download | rails-ad354b207a5600fbe7c784f370cf30446925f13c.tar.gz rails-ad354b207a5600fbe7c784f370cf30446925f13c.tar.bz2 rails-ad354b207a5600fbe7c784f370cf30446925f13c.zip |
Added CookieJar#delete and fixed CookieJar[] to just call first, so you get a string instead of an array back. This limits each cookie to one value, which I consider a mighty fine restriction
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@92 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/cookies.rb')
-rw-r--r-- | actionpack/lib/action_controller/cookies.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 924dc714b1..80ee617987 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -36,7 +36,7 @@ module ActionController #:nodoc: # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method # or cookies[]= (for simple name/value cookies without options). def [](name) - @cookies[name.to_s].value if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) + @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) end def []=(name, options) @@ -49,6 +49,11 @@ module ActionController #:nodoc: set_cookie(name, options) end + + # Removes the cookie on the client machine by setting the value to an empty string. + def delete(name) + set_cookie(name, "value" => "") + end private def set_cookie(name, options) #:doc: |