This project is archived and is in readonly mode.

#3375 ✓stale
Jeffrey Hardy

CookieJar#delete should return the key's value, consistent with a Hash

Reported by Jeffrey Hardy | October 14th, 2009 @ 05:37 AM

ActionController::CookieJar is a Hash, but #delete differs from that of its superclass:

cookies[:foo] = 'bar'
cookies.delete(:foo) # => ["foo=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]

This patch makes the return value of #delete consistent with a regular Hash.

cookies[:foo] = 'bar'
cookies.delete(:foo) # => "bar"

I also slipped in an assertion for Session#delete (whose return value was correct, but untested).

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages