Gruff Caching?

I have a partial that I am rendering that contains several graphs
generated by gruff. These graphs are displaying data points pulled
from my database, and I want to allow the user to change the
datapoints (filter based on criteria). I have the graphs being
written into a directory and I have the filter actions set up to
redraw the graphs which is getting done (if I look at the directory
the graphs are put into the files are being replaced with the new
graphs) but the browser is not redrawing the partial after I update
the graphs. I am calling the graphs via an image tag. The filter is
being set by a form_remote_tag. My question really is how do I force
a partial to redraw everything no matter what.

Andrew

generating a new, unique graph file name everytime the data is changed
should do it.

Lou V. <vanek@…> writes:

generating a new, unique graph file name everytime the data is changed should
do it.

is not redrawing the partial after I update the graphs. I am calling
the graphs via an image tag. The filter is being set by a
form_remote_tag. My question really is how do I force a partial to
redraw everything no matter what.

Andrew

Another option is to send the graph data to the browser directly rather
than
writing it to disk. Not the most efficient practice but not necessarily
bad if
your data source changes constantly.

def make_graph
g = Gruff::Line.new

send_data(g.to_blob, :filename => “ck.png”, :type => ‘image/png’,
:disposition
=> ‘inline’)
end

Then you can just invoke the controller method directly in your image
source:

there’s also the ‘no-cache’ header directive,
http://www.htmlgoodies.com/beyond/reference/article.php/3472881

On Dec 5, 2005, at 9:56 PM, Tyler K. wrote:


send_data(g.to_blob, :filename => “ck.png”, :type => ‘image/
png’, :disposition
=> ‘inline’)
end

Then you can just invoke the controller method directly in your
image source:

hm, I tried this before I asked the question but perhaps I did
something wrong. I am writing multiple graphs to the page and kept
getting a multiple render error which made me go the route of writing
the graphs to disk.

Andrew

Sorry to bump such an old topic, but I’ve run in to much the same
problem. I’m rendering a partial which is re-rendered every so often
using AJAX. Both suggestions mentioned above don’t appear to work
(changing the filename sent with each request and calling the controller
directly). I’ve also used a simple method to alter HTTP headers with
pragma and no-cache, all to no avail.

Does anyone have any other suggestions?

For reference, here’s some snippets:

Gruff controller:
send_data(g.to_blob, :disposition => ‘inline’, :type => ‘image/png’)

View: