Understanding when flash gets reset (render vs. redirect_to)


#1

All,

I have a controller action that will do a different “render (:action)”
call
depending on whether or not data is valid.

When the data is invalid - I set a flash element to hold a message.

However, when I post back to this controller action and have valid data,
I still have the flash element set, which I don’t want.

I believe this is because I did a render from the initial controller
call.

Do I need to use flash.now in this case because I haven’t really
generated a new controller instance?

Thanks,
Wes


#2

Hey,

flash.now[:wibble] = “visible as flash[:wibble] in this request”
flash[:wibble] = “visible as flash[:wibble] in the next request”

HTH,
Trevor

Trevor S.
http://somethinglearned.com


#3

Trevor,

You the man.

WG
Trevor S. wrote:

Hey,

flash.now[:wibble] = “visible as flash[:wibble] in this request”
flash[:wibble] = “visible as flash[:wibble] in the next request”

HTH,
Trevor

Trevor S.
http://somethinglearned.com