【发布时间】:2017-06-20 23:46:41
【问题描述】:
我有一个 Rails 应用程序,它可以让用户获得多个报价。我将每个报价存储在这样的 cookie 中:
if !results.nil?
cookies["quote_#{SecureRandom.uuid}"]
end
当用户创建多个引号时,我将拉出 cookie 以显示在屏幕上。我希望用户能够通过单击按钮来删除或删除所有引用。
如何使用某种通配符来删除所有以 quote_ 开头的 cookie?所以像......
def clear_cookies
cookies.delete "quote_*"
redirect_to compare_path
end
【问题讨论】:
标签: ruby-on-rails cookies