Remove cookie that starts on a specific line in Rails
I have a rails app that includes the ability for users to receive multiple quotes. I store each quote in a cookie like this:
if !results.nil?
cookies["quote_#{SecureRandom.uuid}"]
end
When the user generates multiple quotes, I will pull out the cookies to display on the screen. I want the user to be able to remove or all of their quotes by clicking a button.
How can I use some kind of pattern to remove all cookies starting with quote_? So something like ...
def clear_cookies
cookies.delete "quote_*"
redirect_to compare_path
end
+3
source to share