Is it considered good practice to use the flash to pass temporary data
between pages? Items such a id’s for model objects in case I want to
retrieve the object that was used in the previous page. Or, should I
instead use the session for this purpose, then clear the value out of
the session when it’s no longer needed?
It seems that using the flash works okay and I get the benefit of
having it automatically clear when it’s no longer needed. However, I’m
not sure if there are caveats to using the flash.
I think using flash for passing temporary data between pages or actions
ok, since the documentation tells you so.
However I still recommend using the standard session to carry data
different actions, since it simply seems to be the designed thing to do
while flash’s primary purpose seems to be storing notices and warnings.
And you don’t run that easily into situations where you’re losing all
The flash is just a “special” hash that is stored in the session. The
special thing about it is it’s ability to clear itself after the next
request. As long as you are sure this behavior won’t bite you in the
butt, there is nothing wrong with what you want to do.
I think now it might “bite me in the butt.” After doing some
experimenting I realize I have some issues with backtracking when
using flash. Probably better to just store in the session and clear
when I no longer need it.