# Question on caching

**URL:** <https://www.ruby-forum.com/t/question-on-caching/178465>\
**Category:** Rails\
**Created:** [November 5, 2009, 12:25am UTC](https://www.ruby-forum.com/t/question-on-caching/178465 "2009-11-05T00:25:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfburke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ea5d25/32.png) [@gfburke](https://www.ruby-forum.com/u/gfburke)\
**Post date:** [November 5, 2009, 12:25am UTC](https://www.ruby-forum.com/t/question-on-caching/178465/1 "2009-11-05T00:25:09Z")

</div>

Hi there, I have a question about caching templates. We have a need  
to modify certain erb files on the filesystem from time to time, but  
when modified they don’t update in the Rails app until the server is  
restarted - they’re being cached in staging and production.

I found numerous blog entries, etc. that indicate that Rails by  
default checks the file modification time of a given template/partial  
before caching it and will refresh from the filesystem if it finds a  
newer template. This is not currently happening.

Has this behavior been removed from Rails 2.3.2 , or how can we force  
this behavior?

-Gary

---

<div class="post-metadata">

**Author:** ![gfburke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ea5d25/32.png) [@gfburke](https://www.ruby-forum.com/u/gfburke)\
**Post date:** [November 5, 2009, 7:04pm UTC](https://www.ruby-forum.com/t/question-on-caching/178465/2 "2009-11-05T19:04:21Z")

</div>

Are you modifying those erb files by hand? Or in code?

If in code, you need to add the appropriate expire calls to flush the  
cache. (But if you’re really modifying erb files as part of your app’s  
normal behavior, that sounds bad and I would look for a better way.)

If by hand, why not just restart the server when they change?  
Typically such modifications would be tested in development mode  
first, then deployed via capistrano or some other automated fashion.  
In the last step, capistrano will restart the server.

---

<div class="post-metadata">

**Author:** ![gfburke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ea5d25/32.png) [@gfburke](https://www.ruby-forum.com/u/gfburke)\
**Post date:** [November 5, 2009, 7:50pm UTC](https://www.ruby-forum.com/t/question-on-caching/178465/3 "2009-11-05T19:50:02Z")

</div>

On Nov 4, 11:21 pm, Gary B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I found numerous blog entries, etc. that indicate that Rails by  
> default checks the file modification time of a given template/partial  
> before caching it and will refresh from the filesystem if it finds a  
> newer template. This is not currently happening.
> 
> Has this behavior been removed from Rails 2.3.2 , or how can we force  
> this behavior?

Isn’t that what config.action\_view.cache\_template\_loading controls ?

Fred
