> Can you provide more info on what you're doing with this searched word? > Highlighting?
I was just using it for coherent navigation. You could go like search => show => edit => update => index and see the list filtered with the searched keyword. > My initial reaction is it's a dubious practice, because it relies on the > user visiting the same controller action in the next request. Well, that was exactly my point. I expected the user to visit same controller. > If they open a > page in another tab, for instance, it'd get messed up. Unfortunately true. > I'd usually favor embedding that parameter in the form for the next request > (e.g., for a search form, prepopulate the query box with the searched word). > If you want it to persist for longer, then perhaps cookie/session storage > makes more sense. cookie/session store has exactly the same problem as flash (in another tab). In fact flash is stored in session. It is a serialized hash. The only solution for doing it right is to keep that searched word in url. But that requires you to write some abstraction over link_to or remember to add additional parameter to every possible link_to that is leading to same controller. Cumbersome. >> How can I keep something for >> the next request when rendering in your proposed solution? Would I >> have to set flash and keep it in the same request ? >> >> flash[:keyword] = "searched term" >> flash.keep :keyword >> render :search > > > Something like that. Or even: > > flash.keep[:keyword] = 'searched term' Works fine for me. > i.e., keep the common case clean, at the expense of making the unusual case > a bit more work. I agree. Just didn't want the unusual case to be impossible after some refactoring. > Thanks for your input. :) You are welcome. Robert Pankowecki -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
