How to disable sending cookies for a certain route only?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 08:31:09

问题


I've been searching for this information and haven't found anything.

I want to disable cookies only for a particular route. Is there a way to do that?


回答1:


Doesn't work in the routes file, but you can always use this in associated controllers:

before_action :skip_cookies

and as a private method:

def skip_cookies
  request.session_options[:skip] = true
end

That should avoid including any cookies for the actions inside the controller



来源:https://stackoverflow.com/questions/53809314/how-to-disable-sending-cookies-for-a-certain-route-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!