Hi all, 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I think using flash for passing temporary data between pages or actions is ok, since the documentation[1] tells you so. However I still recommend using the standard session to carry data between different actions, since it simply seems to be the designed thing to do so 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 your precious data. ;-) Cheers, Markus [1] http://api.rubyonrails.com/classes/ActionController/Flash.html On 10/2/07, Robert Walker <rwalker348-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi all, > > 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. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. Robert Walker wrote:> Hi all, > > 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. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Oct 2, 2:20 pm, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote:> 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. > > Robert Walker wrote: > > Hi all, > > > 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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---