Forum: Ruby on Rails fragment caching with search box

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Scott K. (Guest)
on 2008-10-03 05:04
I'm trying to setup some fragment caching which works fine for the index
but i'm not sure how to ignore the caching if they are searching the
index results.

my code in short:


def index
      @items =[:search], params[:min_rank],
params[:max_rank], params[:classification_id], ...)

<% cache ('items', {:page => params[:page] || 1}) do %>
  <% for item in @items %> output
   <% end %>
<% end %>

so my question is, what is the best way for me to ignore the caching in
the index view if they enter a search term?  maybe put an if statement
to see if params[:search] is set?

how do you guys do this with multiple page views in the index with
This topic is locked and can not be replied to.