aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2009-02-10 12:09:49 -0600
committerJoshua Peek <josh@joshpeek.com>2009-02-10 12:09:49 -0600
commit199e750d46c04970b5e7684998d09405648ecbd4 (patch)
tree97f847ba98946ac2da003831042966afb1017268 /actionpack/lib/action_view/template.rb
parent1dab1d380377f1a2a60da43bc22989d55632d246 (diff)
downloadrails-199e750d46c04970b5e7684998d09405648ecbd4.tar.gz
rails-199e750d46c04970b5e7684998d09405648ecbd4.tar.bz2
rails-199e750d46c04970b5e7684998d09405648ecbd4.zip
Fix some edge cases when the same template is called with different local assigns
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r--actionpack/lib/action_view/template.rb23
1 files changed, 11 insertions, 12 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index ee1b9f2886..f2d3998d16 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -7,7 +7,9 @@ module ActionView #:nodoc:
def initialize(path)
raise ArgumentError, "path already is a Path class" if path.is_a?(Path)
@path = path.freeze
+ end
+ def load!
@paths = {}
templates_in_path do |template|
load_template(template)
@@ -44,6 +46,7 @@ module ActionView #:nodoc:
# etc. A format must be supplied to match a formated file. +hello/index+
# will never match +hello/index.html.erb+.
def [](path)
+ load! if @paths.nil?
@paths[path] || find_template(path)
end
@@ -197,26 +200,22 @@ module ActionView #:nodoc:
end
def stale?
- !frozen? && mtime < mtime(:reload)
+ reloadable? && (mtime < mtime(:reload))
end
def load!
reloadable? ? memoize_all : freeze
end
- private
- def cached?
- Base.cache_template_loading || ActionController::Base.allow_concurrency
- end
-
- def reloadable?
- !cached?
- end
+ def reloadable?
+ !(Base.cache_template_loading || ActionController::Base.allow_concurrency)
+ end
- def recompile?
- reloadable? ? stale? : false
- end
+ def cached?
+ ActionController::Base.perform_caching || !reloadable?
+ end
+ private
def valid_extension?(extension)
!Template.registered_template_handler(extension).nil?
end