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?
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.
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.