Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete encrypted cookies on rails?

I'm trying to delete cookies set by

cookies.encrypted['something'] = 'a thing'

in a rspec file but cookies.encrypted.delete does not exist, I've checked on the docs, and cookies.delete['something'] just delete non-encrypted cookies

like image 766
Guilherme Luiz Avatar asked Sep 06 '25 03:09

Guilherme Luiz


1 Answers

An encrypted cookie is just a cookie whose value is encrypted. It's still a cookie like any other, and can be deleted in the same way. Simply use

cookies.delete('something')
like image 170
Brian Avatar answered Sep 07 '25 20:09

Brian