# View problem - incorrect image

**URL:** <https://www.ruby-forum.com/t/view-problem-incorrect-image/81161>\
**Category:** Rails\
**Created:** [January 5, 2007, 11:53am UTC](https://www.ruby-forum.com/t/view-problem-incorrect-image/81161 "2007-01-05T11:53:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 5, 2007, 11:53am UTC](https://www.ruby-forum.com/t/view-problem-incorrect-image/81161/1 "2007-01-05T11:53:32Z")

</div>

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?

Controller:  
def create\_chart  
image.write(‘public/images’)  
end

View:  
 ![]()

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 5, 2007, 12:18pm UTC](https://www.ruby-forum.com/t/view-problem-incorrect-image/81161/2 "2007-01-05T12:18:05Z")

</div>

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  
experiencing.

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 5, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/view-problem-incorrect-image/81161/3 "2007-01-05T12:35:20Z")

</div>

It runs on the same machine, so the system clock is synchronized. How  
can I reload the template?

---

<div class="post-metadata">

**Author:** ![flnative](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@flnative](https://www.ruby-forum.com/u/flnative)\
**Post date:** [January 5, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/view-problem-incorrect-image/81161/4 "2007-01-05T14:07:47Z")

</div>

\<%= image\_tag ‘public/images/test1.png’ %\>  
So the image will not cached!
