Changeset 7161
- Timestamp:
- 07/01/07 23:35:07 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-stable/actionpack/CHANGELOG
r6993 r7161 1 1 *SVN* 2 3 * Allow you to delete cookies with options. Closes #3685 [josh, Chris Wanstrath] 2 4 3 5 * Deprecate pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin. #8157 [Mislav Marohnic] branches/1-2-stable/actionpack/lib/action_controller/cookies.rb
r5207 r7161 63 63 64 64 # Removes the cookie on the client machine by setting the value to an empty string 65 # and setting its expiration date into the past 66 def delete(name) 67 set_cookie("name" => name.to_s, "value" => "", "expires" => Time.at(0)) 65 # and setting its expiration date into the past. Like []=, you can pass in an options 66 # hash to delete cookies with extra data such as a +path+. 67 def delete(name, options = {}) 68 options.stringify_keys! 69 set_cookie(options.merge("name" => name.to_s, "value" => "", "expires" => Time.at(0))) 68 70 end 69 71 branches/1-2-stable/actionpack/test/controller/cookie_test.rb
r5978 r7161 30 30 def logout 31 31 cookies.delete("user_name") 32 end 33 34 def delete_cookie_with_path 35 cookies.delete("user_name", :path => '/beaten') 36 render_text "hello world" 32 37 end 33 38 … … 86 91 assert_equal nil, jar["something_else"] 87 92 end 93 94 def test_delete_cookie_with_path 95 get :delete_cookie_with_path 96 assert_equal "/beaten", @response.headers["cookie"].first.path 97 assert_not_equal "/", @response.headers["cookie"].first.path 98 end 88 99 end