简体   繁体   中英

How to read cookies of an application from a rails gem

I wrote a gem which will read the cookies of an application that installs my gem. But, I am not able to do that because when I try to add the line cookies[:name] , it is throwing the exception undefined method "cookies" .

How to achieve this? Your help is appreciated.

First of all, applications don't store cookies, only browsers do. That said, you can access those cookies from your controllers. See the documentation on cookies here: http://guides.rubyonrails.org/action_controller_overview.html#cookies

Your question is kind of vague. You might have to share some code to get a quality answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM