flash message not shown after redirect_to

Ehud,

I think I know what’s going on here.

Think of redirect_to like a render() call that just sends a response which causes the browser to request the page you passed to redirect_to.

There are 3 request/response cycles involved here. You are putting something in the flash in one action which then renders a page (cycle 1), then the user clicks a link on that page to an action which redirects (cycle 2). That causes the browser to request, and the server to deliver, another page (cycle 3). The values you put in the flash during cycle 1 will be intact during cycle 2 but they’re gone in cycle 3.

Is this what’s goin’ down?

Solution: flash.keep()
In cycle 2, before calling redirect_to, call flash.keep . . you can pass it a key from the hash if you only want to preserve part of the flash hash.

:sunglasses:

Cool. I hadn’t come across flash.keep. Thanks, Blake.

Best regards,

Bill