From fd65d89e07d57d809c69043b52a3a1319fb3c2ad Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sun, 1 Jul 2007 23:27:59 +0000 Subject: Allow you to delete cookies with options. Closes #3685 [josh, Chris Wanstrath] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7160 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/cookies.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller/cookies.rb') diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 52423aa61b..d337491ecb 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -62,9 +62,11 @@ module ActionController #:nodoc: end # Removes the cookie on the client machine by setting the value to an empty string - # and setting its expiration date into the past - def delete(name) - set_cookie("name" => name.to_s, "value" => "", "expires" => Time.at(0)) + # and setting its expiration date into the past. Like []=, you can pass in an options + # hash to delete cookies with extra data such as a +path+. + def delete(name, options = {}) + options.stringify_keys! + set_cookie(options.merge("name" => name.to_s, "value" => "", "expires" => Time.at(0))) end private -- cgit v1.2.3