Forum: Ruby on Rails view problem - incorrect image

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.
C0dd31d9c6d343ca4ec4428a7a76ace7?d=identicon&s=25 K. R. (ribit)
on 2007-01-05 11:53
Hi everyone

I generate two images (charts - png format) in my controller with
"Gruff". The images are saved in /public/images. That runs correctly!

So rails is calling the template "create_chart.rhtml". After, I linked
the image with the html tag into the template. When the site is
appearing in the browser, the images are linked, but the wrong one are
there. It seems like, that rails are so fast, that the images aren't
generate at this time. When I press F5 to reload the site, the correct
images are appear.

Can anyone help to solve this problem?

  def create_chart

<img src="images/image1.png">
F5c118aaeb5bb7162db613a37e595be8?d=identicon&s=25 Mick Sharpe (micksharpe)
on 2007-01-05 12:18
This could be a caching problem due to client/server time differences.
Are you running Rails and your web browser on different machines?  If
so, are the system clocks synchronized (using network time clients)? A
difference of a few seconds could cause the problems you are
C0dd31d9c6d343ca4ec4428a7a76ace7?d=identicon&s=25 K. R. (ribit)
on 2007-01-05 12:35
It runs on the same machine, so the system clock is synchronized. How
can I reload the template?
C0dd31d9c6d343ca4ec4428a7a76ace7?d=identicon&s=25 K. R. (ribit)
on 2007-01-05 14:07
<%= image_tag 'public/images/test1.png' %>
So the image will not cached!
This topic is locked and can not be replied to.