aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 7fc0c3b020..95ee177314 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -269,11 +269,15 @@ module ActionView #:nodoc:
def read_template_file(template_path, extension)
info = @@loaded_templates[template_path]
- read_file = info.nil? || ( info.is_a?(Time) ?
- info < File.stat(template_path).mtime :
- !@@cache_template_loading )
+ # info is either the template source code, or the its compile time, or nil
+ # if nil, we need to read it from the file system
+ # if it is a time, we need to reread it if it has changed on disk
+ # if @@cache_template_loading is true, we will never reread
+ unless read_file = info.nil?
+ read_file = !@@cache_template_loading && info.is_a?(Time) && info < File.stat(template_path).mtime
+ end
if read_file
- @@loaded_templates[template_path] = info = File.read(template_path)
+ info = @@loaded_templates[template_path] = File.read(template_path)
@@compiled_templates[template_path] = nil
end