On Fri, Sep 7, 2012 at 4:02 PM, Robert Pankowecki <
robert.pankowe...@gmail.com> wrote:

> I sometimes use flash to keep things between multiple request ex.
> searched word and use FlashHash#keep in before filter to keep it when
> user is still using the same controller.


Can you provide more info on what you're doing with this searched word?
Highlighting?

My initial reaction is it's a dubious practice, because it relies on the
user visiting the same controller action in the next request. If they open
a page in another tab, for instance, it'd get messed up.

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.

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'

i.e., keep the common case clean, at the expense of making the unusual case
a bit more work.

Thanks for your input. :)

-- 
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to