Delete cookies by giving them an expiry in the past, cf. tools.ietf.org/html/rfc6265#section-4.1.2.
Most importantly, as specified in tools.ietf.org/html/rfc6265#section-4.1.2.4 and in section 5.1.4, cookies set without a path will be set for the current “directory”, that is:
> ... the characters of the uri-path from the first character up
> to, but not including, the right-most %x2F ("/").
However, Firefox includes the right-most slash when guessing the cookie path, so we must resort to letting browsers estimate the deletion cookie path again.
def delete_cookie_for_current_directory(cookie_name)
unless current_directory_is_root?
one_week = (7 * 24 * 60 * 60)
set_cookie!(cookie_name, "", :path => nil, :expire_after => -one_week)
end
end