Changeset 7160
- Timestamp:
- 07/01/07 23:27:59 (1 year ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cookies.rb (modified) (1 diff)
- trunk/actionpack/test/controller/cookie_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r7158 r7160 1 1 *SVN* 2 3 * Allow you to delete cookies with options. Closes #3685 [josh, Chris Wanstrath] 2 4 3 5 * Allow you to render views with periods in the name. Closes #8076 [norbert] trunk/actionpack/lib/action_controller/cookies.rb
r5207 r7160 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 trunk/actionpack/test/controller/cookie_test.rb
r5977 r7160 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