diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/session/cookie_store.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/session/cookie_store.rb b/actionpack/lib/action_controller/session/cookie_store.rb index 7f0afbd4b0..01f059f156 100644 --- a/actionpack/lib/action_controller/session/cookie_store.rb +++ b/actionpack/lib/action_controller/session/cookie_store.rb @@ -96,6 +96,7 @@ class CGI::Session::CookieStore # Delete the session data by setting an expired cookie with no data. def delete @data = nil + clear_old_cookie_value write_cookie('value' => '', 'expires' => 1.year.ago) end @@ -134,4 +135,9 @@ class CGI::Session::CookieStore cookie = CGI::Cookie.new(@cookie_options.merge(options)) @session.cgi.send :instance_variable_set, '@output_cookies', [cookie] end + + # Clear cookie value so subsequent new_session doesn't reload old data. + def clear_old_cookie_value + @session.cgi.cookies[@cookie_options['name']].clear + end end |