简体   繁体   中英

actiondispatch cookieoverflow post request

I have a form in which I add custom html in body of form(By JS). When I add like 20 objects(3 input fields in a row), I get rails error ie

ActionDispatch::Cookies::CookieOverflow

It occur sometimes, sometimes it dont. I dont the main reason behind this. The request is POST.

I got the cause for this behavior. Actually, the flash messages are saved in cookies by rails. So when we send post request, like in my case I sent many data which will all first validate and then error messages will be added to flash. Now for those 20 objects, error messages were also 20(actually more than 20). That's why cookie were overflow.

I faced the same problem when I tried to display the flash messages with tons of errors. My solution was change to ActiveRecord::SessionStore You can find the docs here https://api.rubyonrails.org/v3.2/classes/ActiveRecord/SessionStore.html

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