Rails, by default, stores session data in cookies. The cookies have a storage limit of 4K and cookie overflow exception is raised if we attempt to store more than 4K of data in it. Cookie overflow issue with Rails 4.x Flash messages are persisted across requests with the help of session storage. Flash messages like flash.now are marked as discarded for next request. So, on next request, it gets de
![Rails 5 Discard some flash messages to trim storage](https://cdn-ak-scissors.b.st-hatena.com/image/square/df7dcf3e382d2d4b018ba79fc6642260e3fa7070/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fdpc4i4bdx%2Fimage%2Fupload%2Fbigbinary_blogs%2Fdefault_blog_image.png)