ruby on rails - getting the flash hash to persist through redirects -
My original use case is processing something, set flash [: notice]
, and Redirect to a new page that I can tell, the redirect resets the Flash tag (Please correct me if I am wrong) Is there a way to gain persistence? Using the session is not an option, and I've used cookies to hack around the problem, but I think that should be a better way.
The Flash Hash remains true for a redirect or render. So you should be ok with the default settings.
If you need to keep Flash Hash for another request / Redirect, you can call Flash. Keep .keep
Flash. Keep an entire flash hash around for an additional request. Flash.keep (: Notice) # Place Flash [: Notice] for just one additional request.
Comments
Post a Comment